wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes validation problem in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validation problem in jsp" Watch "validation problem in jsp" New topic
Author

validation problem in jsp

A Babu
Ranch Hand

Joined: Nov 28, 2005
Posts: 114
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?


Thanks,
www.Admakr.in
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
A Babu
Ranch Hand

Joined: Nov 28, 2005
Posts: 114
i want client side validation.just for understanding i posted the bean code also.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Nov 28, 2005
Posts: 114
hi all,
please continue this thread.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

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).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
A Babu
Ranch Hand

Joined: Nov 28, 2005
Posts: 114
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

Joined: Jan 10, 2002
Posts: 60774
    
  65

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

Joined: Nov 28, 2005
Posts: 114
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

Joined: Nov 28, 2005
Posts: 114
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

Joined: Jan 10, 2002
Posts: 60774
    
  65

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

Joined: Nov 28, 2005
Posts: 114
please tell me why it is not working in firefox while working in IE.please give reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validation problem in jsp
 
Similar Threads
multi-step user registration ?
database best practice
No getter method for property ename of bean org.apache. struts.taglib.html. BEAN
error occuring while use jsp
Null Pointer Exception