• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validation problem in jsp

 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The below code is my view.jsp file:
=======================================



The below code is Mybean.java file:
=====================================


Now my question is how to make validation in the view.jsp for to validate first name is with uppercase and last name with lowercase and email validation.please give sample code.i tried as in form tag i put onSubmit="return validate()" and head section with function vallidate() but it is not working why? please help.and can we put action= "" and onsubmit="" both in form tag?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where do you want to do the validation?

You've posted your bean's code which would hint that you want server side validation but your questions about onsubmit etc hint that you want to validate on the client (browser) with Javascript.
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want client side validation.just for understanding i posted the bean code also.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you only want help with client side validation, the best place to ask is the HTML/Javascript forum.

I'll have this thread moved there for you.
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
please continue this thread.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we put action= "" and onsubmit="" both in form tag?


Yes.

Why not post your validation code (and omit anything that is not relevant, like borrowed java code).
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for not posting validation code.now i am posting entire jsp with validation code.



why the control is not going to check function in head section.browser showing that errors.if is any problem please give me suggetion.
[ January 12, 2006: Message edited by: babu amara ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the future, instead of saying "the browser is showing errors", show us what the errors are. Otherwise, we just have to guess.

And I'm guessing that your problem is:



the spaces in your element names.

I'd recommend against using spaces at all, but if you must, you'll need to use alternative syntax to access them:


[ January 13, 2006: Message edited by: Bear Bibeault ]
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bear,
here there is no error is showing ,but only the problem is not showing any alert message if i am not enter the email.the information is directly send to server with out validating before.I put the email element 'form email' in single quotes.but no use.

i am trying to make alert message.
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bear,
now it is working thank you.thank you so much.

cheers,
babu.
[ January 18, 2006: Message edited by: babu amara ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Run your script in Firefox with the Javascript console displayed. I'm betting you'll see error messages.
[ January 18, 2006: Message edited by: Bear Bibeault ]
 
A Babu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell me why it is not working in firefox while working in IE.please give reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic