Click here to Skip to main content
15,883,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi i'm new to javascript and jquery. i have a from in that i have username and password and country textboxes, and one dropdown and a radiobutton are there. can any one please provide a sample form validation using javascript or jquery.And i want to show the rror message next textbox example for firstname textbox without entering firstname if user press submit button error message should show next to firstname textbox, same to dropdown and radio button.

Thanks
Ravi
Posted
Updated 28-Apr-12 4:14am
v2

1 solution

Sounds like you are in need of RequiredFieldValidator[^]. No need to have a JavaScript validation as validation controls for such direct scenarios exists.

Here have a look at the sample example of using the validator on a login page: Simple ASP.Net Login Page using C#[^]

Still, in case you want, here is how you do JavaScript validation: Client Side Validation with JavaScript in ASP.NET[^]
 
Share this answer
 
Comments
[no name] 28-Apr-12 20:21pm    
hi thanks for the replay perticulary i am looking for client-side validations using JavaScript i have seen the link which u gave in that code they are showing error message as alert, but in my case i want to show inline error message.
Sandeep Mewara 29-Apr-12 0:56am    
Third link is exactly what you need. Modify as per your use. Once you are in Javascript validating, it's on you on how to show the error display.
[no name] 29-Apr-12 4:08am    
Thanks a lot -:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900