dcsimg
Using a jsp variable in java script
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   david_crocker
Posted On:   Wednesday, November 5, 2003 01:58 PM

I want to change a field on a form when a user selects an option from a select tag. The value that I would like to change the form field to is stored in an array. When the user makes a selection I would like to change the form field value. I have tried to use the following code, but can not get it to work. Here is what I tried first: onchange="this.form.requestDescription.value = ' <%= requestDescription['parseInt(this.options[this.selectedIndex].value)']%>" I never got that to work. I am now wanting to call a javascript function, but do not know how to use a jsp variable in the function. Can this be done? Is there a better way? I do not want to submit the form to get the field value changed. Th   More>>

I want to change a field on a form when a user selects an option from a select tag. The value that I would like to change the form field to is stored in an array. When the user makes a selection I would like to change the form field value. I have tried to use the following code, but can not get it to work. Here is what I tried first:

onchange="this.form.requestDescription.value = ' <%= requestDescription['parseInt(this.options[this.selectedIndex].value)']%>"

I never got that to work. I am now wanting to call a javascript function, but do not know how to use a jsp variable in the function. Can this be done? Is there a better way? I do not want to submit the form to get the field value changed.

Thanks for any help!

   <<Less

Re: Using a jsp variable in java script

Posted By:   Firat_Tiryaki  
Posted On:   Wednesday, November 5, 2003 02:18 PM

well, javascript events are client based, so you can not relate them with a server side language if you don't make a request again to the server, try to run the jsp in an iframe or over an invisible image -->
About | Sitemap | Contact