-
[RESOLVED] restricting input text when a @ sign is not present
Hi,
I'm looking for a tutorial where this would be explained. Obviously for an email input field to have the user rewrite it.
Thanks for any suggestions
-
.
Hi Cap,
I think you are looking for a mail form basically, with email check function, maybe tyry this simple example.
2 text fields, Email.text / Errors.text
1 button, sendButton
code:
PHP Code:
// *** text fields
Errors.text = "";
Email.text = "";
// *** check valid email
function Validate(address)
{
if (address.length >= 7)
{
if (address.indexOf("@") > 0)
{
if ((address.indexOf("@") + 2) < address.lastIndexOf("."))
{
if (address.lastIndexOf(".") < (address.length - 2))
{
return (true);
}
}
}
}
return (false);
}
// ** check all form details then send
function FormCheck()
{
if (Email.text.length < 1)
{
Errors.text = "Please enter an E-Mail.";
}
else if (!Validate(Email.text))
{
Errors.text = "Please enter a valid E-Mail.";
}
else
{
Errors.text = "E-mail good to go";
// now send the mail code
}
}
// *** send button
sendButton.onRelease = FormCheck;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|