A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: Required fields reminder

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    2
    I got a form done in flash, and I want to know how to do it so it tells you the required fields are not completed. If anybody could help that would be cool.

  2. #2
    curmudgeon swampy's Avatar
    Join Date
    Jan 2001
    Location
    [wakey]
    Posts
    2,775
    input text box called: "input"

    button :

    Code:
    on (release) {
    
    if(input==""){
    dowhatever
    
    }
    }

  3. #3
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    I'm trying to combine a php/flash email form (working just fine on its own) with basically this exact script for requiring users to fill our various fields (also works just fine on its own.)

    It looks like the conditional statement that examines if, for example, the email field is empty:

    if(email="")

    will only work when the field is not part of a larger symbol.

    Unfortunately this field as well as all the others must be a symbol in order for the "POST" command to work.

    Does anyone know another way to require these fields to be filled. Ideally It would verify every form in the symbol at once since there are no fields I do not wish to be required.

    Thank you!

    == EDIT ==

    I should mention that I'd be happy with any script that allows me to set up multiple input fields, set them as required, and POST them all at once to some PHP script I've already made.

    ========
    Last edited by palantir; 11-08-2007 at 01:32 AM.

  4. #4
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    I'm still playing around with this, but haven't found an answer yet. It's probably absurdly simple... like somehow telling the "if" function to look inside the symbol to find the field it needs to check, but I'm a novice with actionscript and don't know how that would even be formated.

  5. #5
    Senior Member
    Join Date
    Aug 2004
    Location
    plymouth-uk
    Posts
    313
    Quote Originally Posted by palantir
    I'm still playing around with this, but haven't found an answer yet. It's probably absurdly simple... like somehow telling the "if" function to look inside the symbol to find the field it needs to check, but I'm a novice with actionscript and don't know how that would even be formated.

    could you post the code if poss. With in PHP you need double == to check if something is like something eg

    if(email=="") {..

    php is
    if($email=="" || $email == null) { doo stuff }

    hope this helps a liitle
    NOW! look whats happened! I told you to watch this space and now its gone.

  6. #6
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    That was just a typo, sorry about the confusion.

    The code for my button (which should POST the field info to a PHP) page is:
    Code:
    on (release) {
    	// If the field var "name" is empty
    	if (name == "") {
    		// Go to an error page on frame 3
    		gotoAndPlay(3);
    	//If it has anything else
    	} else {
    		//Post all variables in symbol "form," which contains field var "name" to email.php
    		form.loadVariables("email.php", "POST");
    	}
    }
    The code for the symbol "field," which contains the various fields to be submitted is:

    Code:
    onClipEvent(data){
    	// show welcome screen
    	_root.nextFrame();
    }
    The code to my PHP page (Which gathers and mails quite a few fields in symbol "field" is:

    Code:
    <?php
    
    $sendTo = "example@example.com";
    $subject = "Compleded form;
    
    $headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
    
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    
    $headers .= "Return-path: " . $_POST["email"];
    
    $name = $_POST["name"];
    $email = $_POST["email"];
    $phone = $_POST["phone"];
    $other = $_POST["other"];
    
    mail($sendTo, $subject, "Name: ".$name."\r\nEmail: ".$email."\r\nPhone: ".$phone."\r\nOther: ".$other, $headers);
    
    ?>
    Any help is much appreciated.

    Again, I'm OK with scrapping everything I have, if there is a better way. My end goal is an email form with multiple required fields above and beyond the usual "Name" "Email" and "Message" fields.

    I'm pretty sure I've got the PHP side of things down, as long as I can get this post to work

  7. #7
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    OK, I'm still working on this, but I haven't located any answers yet. Since I've only been learning actionscript for the last few weeks, half of what I'm learning is just the syntax of the language.

    I have learned enough to better state what it is I'm looking for, though, so here I'll try again.

    Looking for a script that will first verify that a series of forms are completed (or at least altered from their default values,) and then post those fields to the php file. That's really all there is to it, and it seems like that is the sort of thing Flash should be able to do easily.

    Thanks!

  8. #8
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    for this to return true or false:
    if (name == "")

    you will need to declare it first:
    name = "";

    same with all other textfields.

    btw, there are lots of threads on that topic. Make a search.

    gparis

  9. #9
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    have a look at my flash-feedback form in my library and see if that helps
    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  10. #10
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    Thanks! I've tested out the e-mail form and it looks like it does exactly what I'm looking for (checking for valid email, requiring fields, etc.) Now I'll try to tweak the fields and add new ones to fit what I need

    Thanks again!!!!!

  11. #11
    Junior Member
    Join Date
    Nov 2007
    Posts
    6
    I just wanted to that everyone (especially silentweed) for helping. I finally got it al to work by rewriting everything from the ground up. I mostly didn't know what I was doing with actonscript syntax, but the flash-feedback example was a great guide.

    My working version is completely different that my earlier version OR the examples given, but wouldn't have known what to do without your help. THANKS!

  12. #12
    Junior Member
    Join Date
    Nov 2008
    Posts
    2
    Thanks gparis for that hint, but I found that it only works if you code it like this;

    //for this to return true or false:
    if (name.text == "")

    //you will need to declare it first:
    name.text = "";

    Otherwise it will always fail.

  13. #13
    Junior Member
    Join Date
    Aug 2004
    Posts
    9

    Thumbs up

    Quote Originally Posted by silentweed View Post
    have a look at my flash-feedback form in my library and see if that helps
    Hi ,

    This exactly what I need but I need it in Action script 3 as I need to inserted into my existing Action script 3 code (website). I downloaded but did not work as it complained about Action Script 2.

    can you please let me know what changes are required? I don't have clue about Action scrips but do understand bit like PHP.

    Your help would be most appreciated

    Thanks

  14. #14
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    @oavs
    You should post in the Actionscript 3.0 forum.
    This is AS1 & 2 only.

    gparis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center