Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

validation problem in jsp

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
please continue this thread.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me why it is not working in firefox while working in IE.please give reply.
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic