sai_digitalle
06-04-2005, 05:57 AM
i have text input boxes and the action script i wrote is very VERY basic- so basic that it only checks to make sure that at least something is entered the field. But i'd like to specify format for each respective field (i.e. phone number should be in the format of ###-###-####, and email i want to make sure it is in the format of name@whatever.com etc, event date fomat as ##/##/####)
for gathering the information:
function sendForm() {
gatherForm.recipient = contactForm.recipient.text;
gatherForm.emailto = "andre@immaculate-imagery.com";
gatherForm.visitor_comments = contactForm.userComments.text;
gatherForm.visitor_name = contactForm.userName.text;
gatherForm.visitor_email = contactForm.userEmail.text;
gatherForm.visitor_primaryphone = contactForm.userPhone.text;
gatherForm.visitor_altphone = contactForm.userAltPhone.text;
gatherForm.visitor_eventdate = contactForm.userEventDate.text;
gatherForm.visitor_areaofinterest = contactForm.userOpitions.text;
gatherForm.send ("/cgi-bin/formmail.cgi", "_blank", "POST");
conditional statements:
// onRelease
this.contactForm.submitBtn.onRelease = function() {
if (contactForm.userName.text == "" || contactForm.userEmail.text == "" || contactForm.userPhone.text == "" || contactForm.userAltPhone.text == "" || contactForm.userEventDate.text == "" || contactForm.userComments.text == "" || contactForm.userOptions.label == "Click here to select a subject." ) {
gotoAndStop("error");
} else {
sendForm();
gotoAndStop("correct");
}
and all this does is make sure they at least enter SOMETHING in the fields. i want to specify the format required for the phone number field, e-mail, event date etc...
thanks everyone!
for gathering the information:
function sendForm() {
gatherForm.recipient = contactForm.recipient.text;
gatherForm.emailto = "andre@immaculate-imagery.com";
gatherForm.visitor_comments = contactForm.userComments.text;
gatherForm.visitor_name = contactForm.userName.text;
gatherForm.visitor_email = contactForm.userEmail.text;
gatherForm.visitor_primaryphone = contactForm.userPhone.text;
gatherForm.visitor_altphone = contactForm.userAltPhone.text;
gatherForm.visitor_eventdate = contactForm.userEventDate.text;
gatherForm.visitor_areaofinterest = contactForm.userOpitions.text;
gatherForm.send ("/cgi-bin/formmail.cgi", "_blank", "POST");
conditional statements:
// onRelease
this.contactForm.submitBtn.onRelease = function() {
if (contactForm.userName.text == "" || contactForm.userEmail.text == "" || contactForm.userPhone.text == "" || contactForm.userAltPhone.text == "" || contactForm.userEventDate.text == "" || contactForm.userComments.text == "" || contactForm.userOptions.label == "Click here to select a subject." ) {
gotoAndStop("error");
} else {
sendForm();
gotoAndStop("correct");
}
and all this does is make sure they at least enter SOMETHING in the fields. i want to specify the format required for the phone number field, e-mail, event date etc...
thanks everyone!