Message appear in form validation accordingly.. How?

This is a discussion on "Message appear in form validation accordingly.. How?" within the Flash & Multimedia Forum section. This forum, and the thread "Message appear in form validation accordingly.. How? are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 17th, 2007, 06:11
Junior Member
Join Date: Jul 2007
Location: Malaysia
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Message appear in form validation accordingly.. How?

Hi! I got a question about the form validation. i had create a form with the fields: iname, iemail and ihandphone number. And i had put the actionscript below to the submit button:

Code: Select all
on (release, keyPress "<Enter>") {
    if (iname eq "") {
  imessage = "Please Enter Your Name";
 } else if (iemail eq "") {
  imessage = "Please Enter Your Email Address";
 } else if (!iemail.length || iemail.indexOf("@") == -1 || iemail.indexOf(".") == -1) {
  imessage = "Required: Valid Email Address";
 } else if (ihandphone eq "") {
  imessage = "Please Enter Your Handphone Number";
 } else if(int(ihandphone)==0) {
  imessage = "Required: Valid Handphone Number";
 } else if ((iname.length>4) and (iemail.length>8) and (ihandphone.length>9)) {
        gotoAndPlay(10); 
    } else {
        imessage = "Please enter correct information";
    }
}
So if the user didn't enter their information, it should appear a message such as "Please Enter Your Name" and so on. And it should valid the user start from the name and end with the handphone number is it?

But when i test the movie, if I didn't enter the name, it won't appear the message "Please Enter Your Name", but straight away jump to "Required: Valid Email Address".
However when I test it second time (after submit 1st time, click "back" button and test again), it does... Why?
If the user didn't enter anything or enter it step by step, can it appear with the sequence? :
1) Please Enter Your Name
2) Please Enter Your Email Address
3) Required: Valid Email Address
4) Please Enter Your Handphone Number
5) Required: Valid Handphone Number
6) Please enter correct information


I don't know did I explain it clearly, so I attach the .swf file here. If anybody know how to solve this problem, please reply.

Thanks in advance!!!
Attached Files
File Type: swf validation form.swf (7.0 KB, 19 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 17th, 2007, 14:49
Multimedia Specialist
Join Date: Apr 2007
Location: Arizona
Age: 25
Posts: 666
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Message appear in form validation accordingly.. How?

Interesting, maybe we can use some trickery or something like this to make it work...

Let's add another validation to the beginning, maybe if all the fields have nto been entered it says please enter all required information.

Code: Select all
 
on (release, keyPress "<Enter>")
{
if (iname eq "", iemail eq "", ihandphone eq ""){
imessage = "Please Enter All Required Information";
}
else if (iname eq "") {
  imessage = "Please Enter Your Name";
} else if (iemail eq "") {
  imessage = "Please Enter Your Email Address";
} else if (!iemail.length || iemail.indexOf("@") == -1 || iemail.indexOf(".") == -1) {
  imessage = "Required: Valid Email Address";
} else if (ihandphone eq "") {
  imessage = "Please Enter Your Handphone Number";
} else if(int(ihandphone)==0) {
  imessage = "Required: Valid Handphone Number";
} else if ((iname.length>4) and (iemail.length>8) and (ihandphone.length>9)) {
        gotoAndPlay(10); 
    } else {
        imessage = "Please enter correct information";
    }
}
I'm not sure if this will work or not, but it's worth a shot...
Last Blog Entry: Yay!? (Oct 8th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jul 17th, 2007, 15:24
Up'n'Coming Member
Join Date: Sep 2006
Location: UK
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Message appear in form validation accordingly.. How?

I have never programmed in Actionscript, so I'm pretty much guessing.
Is imessage a variable? Is it possible it's value gets over written if there is more than one error?
i.e.
Code: Select all
on (release, keyPress "<Enter>") {
    if (iname eq "") {
  imessage = "Please Enter Your Name";
// sets imessage as "please enter your name"

 } else if (iemail eq "") {

  imessage = "Please Enter Your Email Address";
// sets imessage as "please enter you email address", but overwriting the previous imessage

etc
Could you try concatenating the imessage strings?
i.e.
Code: Select all
imessage = "";
if (iname eq "", iemail eq "", ihandphone eq ""){
imessage += "Please Enter All Required Information newline";
}
else if (iname eq "") {
  imessage += "Please Enter Your Name newline";
// add string to imessage, appending it to previous imessage
}

etc
But as I said, I have no experience in ActionScript, so this may be of absolutely no use whatsoever.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jul 18th, 2007, 01:58
Junior Member
Join Date: Jul 2007
Location: Malaysia
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Message appear in form validation accordingly.. How?

Thanks for both your replies.

I try both your suggestions, but the same problem come out.

If all the fields have not been entered, it suppose to say "please enter all required information" in the first place, but the message say "Required: Valid Email Address".
After enter the valid email, if the ihandphone didn't enter anthing it should says "Please Enter Your Handphone Number", but it straight away skip to "Required: Valid Handphone Number".
(You can test the .swf file that I have attach below...)

However, when I test it second time (after submit 1st time, click "back" button and test again), it does, it just follow the code accordingly... But why? Why the first time it won't follow it accordingly, just keep skipping to other message. I have to solve this problem ASAP, this is important. As you know, people won't be submit their information twice, and they won't try it for the second time (after submit 1st time, click "back" button and test again)...

So how am I going to solve this problem?
Attached Files
File Type: swf validation form.swf (7.0 KB, 16 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
validation form

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form validation help! psycho wolvesbane JavaScript Forum 16 Feb 12th, 2008 16:40
AS Form / Validation Help papalazarou78 Flash & Multimedia Forum 0 Jul 31st, 2007 19:43
Form Validation feebee JavaScript Forum 1 Aug 3rd, 2006 16:12
PHP Form Validation. kaz PHP Forum 2 Jul 22nd, 2006 20:47
Form Validation Help gajlehab PHP Forum 7 Dec 13th, 2005 19:40


All times are GMT. The time now is 05:52.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42