/    Sign up×
Community /Pin to ProfileBookmark

Problem in Validating Forms

Sir / Mam ,

I am building a registeration form for my website’s users.

After user has filled up every thing,as usual i am checking whether user has filled up every thing or not.

If not then i will alert a message that “u dint fill up the particular field(s)”.When alert message is popped up and clicked ok to fillup the missed field,every thing in the form field is reset,all are going blank.After that user will be in a state to re-fill every thing.

what sud i do to ignore that?please help me out.

Thanx in advance.

regards
shaggy

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CharlesOct 27.2004 — Post the URL.
Copy linkTweet thisAlerts:
@KorOct 27.2004 — You mean, to avoid the reset action when filtering?

Just use [b]onsubmit[/b] as an event handler in form's tag and use a [b]return[/b] conditioner


function validate(){

if(...condition is not fulfilled...){

...alert('message');

...focus();

return false;

}

}

...

<form onsubmit="return validate()">

...

...
×

Success!

Help @neuropac spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...