I am newbie to Webspeed/SpeedScript.
I have a drop down field on my web page (select tag of hmtl). I want the selected value of this drop down using SpeedScript/WebSpeed.
I tried "get-value()" method but this returns blank value. I went through WebSpeed API documenation (http://documentation.progress.com/output/OpenEdge102b/pdfs/aswsp/aswsp.pdf) . There are some other functions like get-field(), get-user-field(). I tried get-field() but there is no success. Please help.
HTML:
<form>
<select id="product" name="prd" onChange="dosmthng()">
<option> 1 </option>
<option> 2 </option>
<option> 3 </option>
</form>
WebSpeed/SpeedScript that I tried:
def variable xy as char.
xy = get-field("prd").
{&OUT} 'window.alert(' + xy + ');'.
Webspeed runs on the server. This means you will have to submit the values of the form for get-field function to work.
HTML:
<form action="your_program.p" method="get">
<select id="product" name="prd" onChange="dosmthng()">
<option> 1 </option>
<option> 2 </option>
<option> 3 </option>
<input type=submit>
</form>
your_program.p:
{&OUT} get-field("prd").
or if you want it to alert:
{&OUT} '<script>'
alert(get-field("prd"))
'</script>'.
If you want webspeed to react to the "onChange" you will have to look into some kind of AJAX-call. Not too hard but try to get the basics running first!