9 Replies Latest reply: Jul 30, 2012 8:47 AM by srbonham1 RSS

    Fetching values from html textbox or any input type

    Pankaj Kumar Mandal
      Hello,

      I am working on APEX 4.1.1 on Linux server. I have created one application in which I have take a HTML region where i have written the following code:

      <input type="text" id="APP_ITEM1" name="APP_ITEM1" />

      I am able to see the text box in page, but not able to fetch the value from it. Please help me on this.
        • 1. Re: Fetching values from html textbox or any input type
          Prabodh
          Hi,
          >
          I am working on APEX 4.1.1 on Linux server. I have created one application in which I have take a HTML region where i have written the following code:

          <input type="text" id="APP_ITEM1" name="APP_ITEM1" />
          >
          Why are you doing this? Why are you not using a regular page item?
          >

          I am able to see the text box in page, but not able to fetch the value from it. Please help me on this.
          >
          Where are you trying to access it? PL/SQL or JS?
          Items rendered this way can be accessed in JavaScript but not in PL/SQL as they are not in the session state and unknown to Apex.

          Cheers,
          • 2. Re: Fetching values from html textbox or any input type
            jariola
            Hi,

            Input tags you write to e.g. HTML tag is not submitted.
            You need use APEX item if you like submit item value and use it in PL/SQL.

            Now you can not submit your page as you have give name attribute your input.
            Submit process collect item values by name attribute. Name is parameter for procedure.
            If you try now submit your page you will get error.

            Regards,
            Jari
            -----
            My Blog: http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME:0
            Twitter: http://www.twitter.com/jariolai
            • 3. Re: Fetching values from html textbox or any input type
              Pankaj Kumar Mandal
              Hi Prabodh,

              Actually I want to access it through JS, please let me know if the values of this type item can stored in the database or can we have communication of input type item to APEX Item and vice -versa? Is this possible?
              • 4. Re: Fetching values from html textbox or any input type
                Prabodh
                Hi,
                >
                Actually I want to access it through JS, please let me know if the values of this type item can stored in the database or can we have communication of input type item to APEX Item and vice -versa? Is this possible?
                >
                The correct way is to use a regular Page Item or the APEX_ITEM API to render your item. If done this way you can access the input item in JS as well as PL/SQL.

                If you must render it the way you are doing then
                a. You can access the value of the item with $v Apex JS API. http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#BGBGDGIH
                b. You can assign the value you obtain above to any existing Apex Page Item using the $s JS API. http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#CHDFBJGD. Note : This could be a Hidden Item
                c. If you want to directly write the value obtained in a. above to DB then you have to use AJAX and write to DB in an OnDemand Process.

                Cheers,
                • 5. Re: Fetching values from html textbox or any input type
                  Pankaj Kumar Mandal
                  Prabodh wrote:
                  Hi,
                  >
                  Actually I want to access it through JS, please let me know if the values of this type item can stored in the database or can we have communication of input type item to APEX Item and vice -versa? Is this possible?
                  >
                  The correct way is to use a regular Page Item or the APEX_ITEM API to render your item. If done this way you can access the input item in JS as well as PL/SQL.

                  If you must render it the way you are doing then
                  a. You can access the value of the item with $v Apex JS API. http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#BGBGDGIH
                  b. You can assign the value you obtain above to any existing Apex Page Item using the $s JS API. http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/javascript_api.htm#CHDFBJGD. Note : This could be a Hidden Item
                  c. If you want to directly write the value obtained in a. above to DB then you have to use AJAX and write to DB in an OnDemand Process.

                  Cheers,
                  Hey thanks for the information can you help me with that last part
                  c. If you want to directly write the value obtained in a. above to DB then you have to use AJAX and write to DB in an OnDemand Process.
                  • 6. Re: Fetching values from html textbox or any input type
                    fac586
                    Pankaj Kumar wrote:
                    Hello,

                    I am working on APEX 4.1.1 on Linux server. I have created one application in which I have take a HTML region where i have written the following code:

                    <input type="text" id="APP_ITEM1" name="APP_ITEM1" />

                    I am able to see the text box in page, but not able to fetch the value from it. Please help me on this.
                    Why the obsession with trying to reinvent APEX in it's own image?

                    <li>{thread:id=2341695}
                    <li>{thread:id=2376694}
                    <li>{thread:id=2380976}

                    What are these recurring requirements you have that you think standard APEX features can't support?
                    • 7. Re: Fetching values from html textbox or any input type
                      Prabodh
                      Pankaj,

                      Jari, fac586 and self , all are trying to dissuade you from taking this approach. You will only end up creating a messy and hard to maintain application.

                      You first need to explain why you cannot use the features available in Apex for your requirement as has been pointed out by fac586 .

                      Cheers,
                      • 8. Re: Fetching values from html textbox or any input type
                        Pankaj Kumar Mandal
                        fac586 wrote:
                        Pankaj Kumar wrote:
                        Hello,

                        I am working on APEX 4.1.1 on Linux server. I have created one application in which I have take a HTML region where i have written the following code:

                        <input type="text" id="APP_ITEM1" name="APP_ITEM1" />

                        I am able to see the text box in page, but not able to fetch the value from it. Please help me on this.
                        Why the obsession with trying to reinvent APEX in it's own image?

                        <li>{thread:id=2341695}
                        <li>{thread:id=2376694}
                        <li>{thread:id=2380976}

                        What are these recurring requirements you have that you think standard APEX features can't support?
                        Hi fac586,

                        This is not obsession, btw I am creating application in APEX with different and some time very complex requirements. I am just finding and using different ways to do the same thing, till now I am understanding APEX, this forum is great way of learning from you guys.
                        • 9. Re: Fetching values from html textbox or any input type
                          srbonham1
                          Just use the following apex javascript API to fetch these values:
                          To Fetch Value:
                          $v('APEX_ITEM1');
                          To fetch the DOM (to manipulate the textfield's style properties etc:
                          $x('APEX_ITEM1');
                          To set the value to something:
                          $x_Value('APEX_ITEM1', 'some value');