Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

validating in javascript and using the variable in Java

 
Ravindra Suroju
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have problem where in I want to check for few conditions in Java Script and I want the results to returned to the Java part of the JSP ...

Can someone please help me.

This is like i have to read few input tags and populate options in the select dropdown.....

Its like reading the few INPUT tags and perform some check and calculations then populate the dropdown.... for checking and validating the I'm using Java Script.... Is it a correct approach....

Thanks in Advance.

Regards,
Ravindra.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ravindra Suroju:
I have problem where in I want to check for few conditions in Java Script and I want the results to returned to the Java part of the JSP ...
Any changes you make to form elements will be reflected when the submission takes place, so you can either set existing form elements to values that you'd like to pass, or create new ones to carry those values.

Its like reading the few INPUT tags and perform some check and calculations then populate the dropdown.... for checking and validating the I'm using Java Script.... Is it a correct approach....
If you are only validating on the client in Javascript, then no, this is not a good approach. While client-side validation is a good and friendly thing to do for the users (so that they get immediate feedback), your server code can never rely on the fact that the validation has taken place and must perform its own validation. JavaScript is easy to disable, and client-side code is too easy too spoof to rely upon client-side validation.
[ June 26, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!