Forum Stats

  • 3,874,589 Users
  • 2,266,749 Discussions
  • 7,911,905 Comments

Discussions

How to get the values of an input text field into the js code????

Ap3x DEV
Ap3x DEV Member Posts: 99
edited Jun 23, 2014 8:01AM in APEX Discussions

i am using the oracle work space and

i have created an html region and creadted an page item text field

i have creted a dynamic action on the region that fires when the page loads

i used the following code in dynamic action that executes the js code to show the value of the input field

but it shows nulll

window.alert($v('p1_value'));

and i also used it with fouble quotes like this

window.alert($v('p1_value");

in alert box it does not show any value anyone can help me where is the mistake

Answers

  • Sunil Bhatia
    Sunil Bhatia Member Posts: 1,280 Bronze Trophy

    Hi,

    Onload text item would be null if your code runs before populating the actual apex item. Why dont you try the same code on button click.

    It will ensure the syntax you are using is correct or not. Also if you are using oracle workspace, share the link of application as well.

    -- Sunil Bhatia

  • Ap3x DEV
    Ap3x DEV Member Posts: 99
    edited Jun 23, 2014 7:46AM

    i have created a dynamic action on button but when i click it does not fires

    work space name persnal

    user name test

    password is 1234gee

    app name is ebay u can chake it out thnx

    nad page number is 5 title is reporting2

  • Tom Petrus
    Tom Petrus Member Posts: 1,151 Gold Trophy

    javascript is case sensitive. Item IDs are generated in uppercase.

    $v('P1_VALUE')

  • Sunil Bhatia
    Sunil Bhatia Member Posts: 1,280 Bronze Trophy

    Your page has 3 errors in javascript console. Correct them and then execute your javascript, it will probably run.

    [blocked] The page at 'https://apex.oracle.com/pls/apex/f?p=56420:5:116547887824068:::::' was loaded over HTTPS, but ran insecure content from 'http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findI…IN&itemFilter(2).value(1)=FixedPrice&itemFilter(2).value(2)=StoreInventory': this content should also be loaded over HTTPS.  f?p=56420:5:116547887824068::::::1

    Uncaught SyntaxError: Unexpected token < f?p=56420:5:116547887824068::::::210

    Uncaught TypeError: undefined is not a function



  • Ap3x DEV
    Ap3x DEV Member Posts: 99

    hi tom thnx for reply and

    i have done that but it still not working

  • Ap3x DEV
    Ap3x DEV Member Posts: 99

    hi sunil thnx for help but i am trying to create a page in apex that will get the data from ebay

    and show it in my apex page in my js code i m actually calling the ebay api and getting the data from it and displaying it in my

    html region div

    <html>

    <head>

    <title>ebay data</title>

    <body>

    <h1>eBay Search Results</h1>

    <div id="results"></div>

    <script>

    // Parse the response and build an HTML table to display search results

    function _cb_findItemsByKeywords(root) {

      var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];

      var html = [];

      html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');

      for (var i = 0; i < items.length; ++i) {

        var item     = items[i];

        var title    = item.title;

        var pic      = item.galleryURL;

        var viewitem = item.viewItemURL;

        if (null != title && null != viewitem) {

          html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +

          '<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td></tr>');

        }

      }

      html.push('</tbody></table>');

      document.getElementById("results").innerHTML = html.join("");

    }  // End _cb_findItemsByKeywords() function

    // Create a JavaScript array of the item filters you want to use in your request

    var filterarray = [

      {"name":"MaxPrice",

       "value":"25",

       "paramName":"Currency",

       "paramValue":"USD"},

      {"name":"FreeShippingOnly",

       "value":"true",

       "paramName":"",

       "paramValue":""},

      {"name":"ListingType",

       "value":["AuctionWithBIN", "FixedPrice", "StoreInventory"],

       "paramName":"",

       "paramValue":""},

      ];

    // Define global variable for the URL filter

    var urlfilter = "";

    // Generates an indexed URL snippet from the array of item filters

    function  buildURLArray() {

      // Iterate through each filter in the array

      for(var i=0; i<filterarray.length; i++) {

        //Index each item filter in filterarray

        var itemfilter = filterarray[i];

        // Iterate through each parameter in each item filter

        for(var index in itemfilter) {

          // Check to see if the paramter has a value (some don't)

          if (itemfilter[index] !== "") {

            if (itemfilter[index] instanceof Array) {

              for(var r=0; r<itemfilter[index].length; r++) {

              var value = itemfilter[index][r];

              urlfilter += "&itemFilter\(" + i + "\)." + index + "\(" + r + "\)=" + value ;

              }

            }

            else {

              urlfilter += "&itemFilter\(" + i + "\)." + index + "=" + itemfilter[index];

            }

          }

        }

      }

    }  // End buildURLArray() function

    // Execute the function to build the URL filter

    buildURLArray(filterarray);

    // Construct the request

    // Replace MyAppID with your Production AppID

    var keywe = "&keywords=query";

    window.alert($v('P5_VALUR'));

    var url = "http://svcs.ebay.com/services/search/FindingService/v1";

        url += "?OPERATION-NAME=findItemsByKeywords";

        url += "&SERVICE-VERSION=1.0.0";

        url += "&SECURITY-APPNAME=WizmenSy-c510-435d-9924-1f1b5e68bb03";

        url += "&GLOBAL-ID=EBAY-US";

        url += "&RESPONSE-DATA-FORMAT=JSON";

        url += "&callback=_cb_findItemsByKeywords";

        url += "&REST-PAYLOAD";

        url +=  keywe;

        url += "&paginationInput.entriesPerPage=3";

        url += urlfilter;

    // Submit the request

    s=document.createElement('script'); // create script element

    s.src= url;

    document.body.appendChild(s);

    </script>

    </body>

    </html>

    this is the code i m actualy executing

    i m using ebay function find items by keywords and input field i m creating so that user can enter the keywords

    and ebay will return the result

    now tel me wht should i do????

This discussion has been closed.