Dropdown Concern in pl/sql server page using Javascript/Jquery

I am a newbie to javascript/jquery so please bare with me. I have a drop-down and followed by a text box. First drop down is a list with static values. Based on the value from the First Drop down, the test box value is populated. (i.e.,Value from drop-down is sent to DB select query and the output from the DB query has to be populated in Text box. It has to happen onChange of value in first drop down.

Can anyone give me a help in below code, as i could not find any example in website?

Have implemented in Pl/SQL Server page(PSP)

******* Code for First Drop down(Select Manufacturer Drop down)********

HTP.PRINT (
'<td align ="left"><a href="' || wro_path
|| 'column_definition?schema_in=DEVICE&table_in=XREF_COMPETITOR_PRODUCTION&column_in=COMPETITOR_NAME">Select Manufacturer</a></td>');
HTP.PRINT ('<td> <select name="p_competitor">');
HTP.PRINT (
'<option value="">'
|| '&nbsp;&nbsp;Enter a New Manufacturer Name or Select to Existing Name to  Edit&nbsp;&nbsp; ');

FOR j IN c_competitor_list_1
LOOP
IF c_competitor = j.competitor_id
THEN
   v_selected :=
      'Enter a New Manufacturer Name or Select to Existing Name to  Edit';
ELSE
   v_selected :=
      'Enter a New Manufacturer Name or Select to Existing Name to  Edit';
END IF;

HTP.PRINT ( '<option '
   || v_selected
   || ' value="'
   || j.competitor_id
   || '">'
   || j.competitor_name);
END LOOP;
HTP.PRINT ('</td>');
HTP.PRINT ('</tr>');

******Have a Text box as below(Manufacturer Field)**********


HTP.PRINT (
'<td  align="left"><a href="' || wro_path || 'column_definition?schema_in=DEVICE&table_in=XREF_COMPETITOR_PRODUCTION&column_in=COMPETITOR_NAME">Manufacturer Name</a></td>');
HTP.tabledata ( '<input type="text" maxlength="100" size="35"  onblur="getFilterText(this);" 
onfocus="setFilterText(this);"  name="p_competitor_name" value="Enter a New Manufacturer Name" >
<b>Required</b></td>');

Thank you

I’m not familiar with that server langauge, but the jQuery is the same:

$('select[name="p_competitor"]').change(function(){
    var $this = $(this)

    //Pass in the URL...
    $.post('yoursite.com'
        //...followed by the data your want to send...
        , {"p_competitor":   $this.val()})
        //...finally, update the textfield with the data. This only gets called after getting data back from the server
        .done(function(data){
            $('input[name="p_competitor_name"]').val(data)
        })
})

You’ll need to query the database on the server using whatever mechanism PSP uses.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.