how to pass textbox value to function?

whosyourdaddy

New Member
hi,

i'm new to progess and i have problem passing value from html textbox to my function. below is the problem:

i have a function under webspeed:

<SCRIPT language="SpeedScript">
FUNCTION TestValue RETURNS CHARACTER(INPUT sCode AS CHARACTER):
DEFINE VARIABLE sDesc as character.

CASE sCode:
WHEN "A" THEN
DO:
sDESC = "AA".
END.
WHEN "B" THEN
DO:
sDESC = "BB".
END.

OTHERWISE
sDESC = sCode.

END CASE.

RETURN sDESC .
END FUNCTION.
</SCRIPT>

and under:

<script ID="clientEventHandlersVBS" LANGUAGE="vbscript">
Sub btnGetValue_onClick
txtDesc.value= "<%=TestValue('" & txtCode.value & "')%>"
msgbox(txtCode.value)
End Sub
</script>

when i click on the btnGetValue button, i want to return some value back to the txtDesc textbox in my html page. but, i alway get "?" display in the txtDesc textbox, but in the msgbox, it display the text that i typed in the txtCode. i suspect there is something wrong in this code:
txtDesc.value= "<%=TestValue('" & txtCode.value & "')%>"

if i hardcode it to txtDesc.value= "<%=TestValue('A')%>" then i can get the correct result "AA" but if i pass using
txtDesc.value= "<%=TestValue('" & txtCode.value & "')%>", it goes to the OTHERWISE case, any idea?

thanks.
 

Casper

ProgressTalk.com Moderator
Staff member
yes, or you have to write some javascript function to retrieve the entered value.
All progress code is handled server side. Client side you just have a HTML page.

Casper.
 
Top