Jump to content

form validating help


darkcarnival

Recommended Posts

hi,

I wish to use either ajax or js or both to validate my php script.

now i am new to js & ajax so im curious if anyone can direct me to a good tutorial or some tips on this.

what I'm looking for?

-when an error occurs a message appears next to the form box

might want this to be ajax-based so that it can check this before anything processes.

i know ipb does something similar, so if someone knows how they do it, that'd help even more.

thank you in advance.
Link to comment
Share on other sites

Use javascript to valiate basic things,
like wether en email address is really an email address,
or if the number you products you want to order is an actual interger.

Use ajax to validate specific things,
like if your particular email address is in a database.

[code]
<script>
function validate()
{
var e = document.getElementById('thing').value;
if (e == '') {alert('dude, its blank');}
else if (isNaN(e)) {alert('dude, thats not a number');}
    else {alert('ok, looks good.')}
}

<input type="text" id="thing" name="thing">
<input type="button" onclick="validate();" value="check">
</script>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.