Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
validating a form before new page submission
Old 12-05-2005, 07:12 AM validating a form before new page submission
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
How do i validate a form before it is actually submitted.

My problem comes from using a fileupload object that require processing on anew page.
I wish though to remain with my form if the user doesnt make an entry.

I dont however want to se the alert message hwoever, just simply put an asterix or something next to the wrongly emtered field.

hwo do i do this
cheers
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 12-05-2005, 08:17 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
You need to attach something to the onClick event of the button, i.e. your validation function. If the validation fails, the function should return False and then the form won't get submitted.

An easier way is to switch to ASP.NET and use validation controls. They will handle both server and client side validation for you, and will make sure that if JavaScript isn't available on the client, that validation still occures on the server. It's as easy as:
<asp:RequiredFieldValidator id="rfvName" runat="server" ControlToValidate="txtName" ErrorMessage="*" Display="Dynamic" />
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Minaki; 12-05-2005 at 08:20 AM..
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 12-05-2005, 09:40 AM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
OK thanks that great.
cheers for your input

Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to validating a form before new page submission
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11578 seconds with 12 queries