Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I am getting text box value null when set by javascript  RSS feed

 
Tushar tej
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
In my jsp page I have list box which is populated from db.




i have other text box "comp_action"into which I have to put above selected value. I do this by using onchange="return pend_assign() of 'pend_desc' list box



On Submit I call function onSubmit(form) and call another jsp page



In onSubmit function when I check value of "comp_action" using alert(Form1.comp_action.value) I get the correct value which was set from list box

But in FieldReportSubmit.jsp when I read


I get "comp_action" value as null.
Why it is happening I should get the value set by javascript function.

Please advice.

Tushar
[ December 28, 2008: Message edited by: Tushar tej ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aside from commenting on what poor practice it is to perform data manipulation in the JSPs -- especially database access -- be sure that the text field is part of the form that is being submitted.

A null value indicates that the named control was not submitted at all and has nothing to do with whether its value was assigned via JavaScript or not.
 
Tushar tej
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Aside from commenting on what poor practice it is to perform data manipulation in the JSPs -- especially database access -- be sure that the text field is part of the form that is being submitted.


Hi Bear Bibeault
Can you Please tell me the correct way for accessing db data or provide some link

A null value indicates that the named control was not submitted at all and has nothing to do with whether its value was assigned via JavaScript or not.


I found out my mistake.
Before assigning value from list box to text box I was disabling the text box. If I dont disable text box I get the value of text box in next jsp page. Now instead of disabling text box I hide it
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, a disabled control will not participate in a submission.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!