Hello, obviously new and need of help

  • fishbulb
  • Born
  • Born
  • fishbulb
  • Posts: 2

Post 3+ Months Ago

Hi I am fish.

Admittedly, I am not a pro at actionscipt forms, but I am a decent designer, I make them look pretty and I can get them to function. That being said, I have a couple of questions about a few current requests and I was hoping I could get some top notch help.

1) I would like the date to automatically show up in the subject

subject="[desired subject to email] " + Date.getDate();

this is not working as I get a blank

2) I have several fields that may be left blank in the form, and if they are left blank I would like them not to show up in the output at all. How would I do that.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Flanders
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Reno, Nevada US

Post 3+ Months Ago

You would need to make a new Date Instance:

Code: [ Select ]
var now:Date = new Date();


and then call the date info out with:

Code: [ Select ]
now.getDate();  //Day of month
now.getFullYear();  //Year
now.getMonth();  //Month Number (0 for Jan, 1 for Feb, ...)
now.getHours(); //Hour Number (0 - 23)
  1. now.getDate();  //Day of month
  2. now.getFullYear();  //Year
  3. now.getMonth();  //Month Number (0 for Jan, 1 for Feb, ...)
  4. now.getHours(); //Hour Number (0 - 23)


and so on.

Code: [ Select ]
var stamp:String = new String();
stamp = now.getMonth()+"/"+now.getDate();+"/"+now.getFullYear();
subject = "[desired subject]" + stamp;
  1. var stamp:String = new String();
  2. stamp = now.getMonth()+"/"+now.getDate();+"/"+now.getFullYear();
  3. subject = "[desired subject]" + stamp;
  • fishbulb
  • Born
  • Born
  • fishbulb
  • Posts: 2

Post 3+ Months Ago

great! Worked like a charm.

Now the second part of my problem.

I have a lot of information being filled out and then put into an email. A lot of it is optional, what they want is the non optional things not to show up in the output if it is left blank.

Code: [ Select ]
 
on (press){
    if (client_name eq "") {
        gotoAndStop('incorrect');
    }
    else {
    email="email address";
    subject="[desired subject to email] " + myDisplay;
    var together;
    together+= "Request Date = " +  Date.getDate() + "%0A";
    together+= "FA = "          +   gpn  + "%0A";
    together+= "Company Name = "            +   client_name + "%0A";
    together+= "Company Type = " + newdoc.getValue() + "%0A";
    together+= "Contact Name = " + clientcontact + newline + "%0A";
    together+= "Checkbox1 =  "      +   checkbox1.getValue()  + " 1Value = " + value1 + newline;
    together+= "Cgeckbox2=  "       +   stock_option.getValue()  + " 2Value = " + value_stockopt  + newline;
    together+= "Checkbox3 =  "      +   checkbox2.getValue()  + " 3Value = " + value2  + newline;
    together+= "Checkbox4 =  "      +   checkbox3.getValue()  + " 4Value = " + value3  + newline;
    together+= "Checkbox5 =  "      +   deferred_comp.getValue()  + " 5Value = " + value_deferred + newline;
    together+= "Checkbox6=  "       +   checkbox4.getValue()  + " 6Value = " + value4  + newline;
    together+= "Checkbox7 =  "      +   checkbox5.getValue()  + " 7Value = " + value5  + newline;
    together+= "Checkbox8=  "       +   plans529.getValue()  + " 8Value = " + value_529  + newline;
    together+= "Checkbox9 =  "      +   exec_based.getValue()  + " 9Value = " + value_execbased  + newline + "%0A";
    together+= "Partner1 = " + name1 + " Partner1 GPN = " + gpn1  + newline;
    together+= "Partner2 = " + name2 + " Partner2 GPN = " + gpn2  + newline;
    together+= "Partner3 = " + name3 + " Partner3 GPN = " + gpn3  + newline;
    together+= "Partner4 = " + name4 + " Partner4 GPN = " + gpn4  + newline;
    together+= "Partner5 = " + name5 + " Partner5 GPN = " + gpn5  + newline;
    together+= "Partner6 = " + name6 + " Partner6 GPN = " + gpn6  + newline;
    String(together);
    mailto = "mailto:" + email + "?subject=" + subject + "&body=" + together;
    getURL(mailto,"_self" );
    }
}
 
on (release) {
    getURL("javascript:window.close()");
}
 
  1.  
  2. on (press){
  3.     if (client_name eq "") {
  4.         gotoAndStop('incorrect');
  5.     }
  6.     else {
  7.     email="email address";
  8.     subject="[desired subject to email] " + myDisplay;
  9.     var together;
  10.     together+= "Request Date = " +  Date.getDate() + "%0A";
  11.     together+= "FA = "          +   gpn  + "%0A";
  12.     together+= "Company Name = "            +   client_name + "%0A";
  13.     together+= "Company Type = " + newdoc.getValue() + "%0A";
  14.     together+= "Contact Name = " + clientcontact + newline + "%0A";
  15.     together+= "Checkbox1 =  "      +   checkbox1.getValue()  + " 1Value = " + value1 + newline;
  16.     together+= "Cgeckbox2=  "       +   stock_option.getValue()  + " 2Value = " + value_stockopt  + newline;
  17.     together+= "Checkbox3 =  "      +   checkbox2.getValue()  + " 3Value = " + value2  + newline;
  18.     together+= "Checkbox4 =  "      +   checkbox3.getValue()  + " 4Value = " + value3  + newline;
  19.     together+= "Checkbox5 =  "      +   deferred_comp.getValue()  + " 5Value = " + value_deferred + newline;
  20.     together+= "Checkbox6=  "       +   checkbox4.getValue()  + " 6Value = " + value4  + newline;
  21.     together+= "Checkbox7 =  "      +   checkbox5.getValue()  + " 7Value = " + value5  + newline;
  22.     together+= "Checkbox8=  "       +   plans529.getValue()  + " 8Value = " + value_529  + newline;
  23.     together+= "Checkbox9 =  "      +   exec_based.getValue()  + " 9Value = " + value_execbased  + newline + "%0A";
  24.     together+= "Partner1 = " + name1 + " Partner1 GPN = " + gpn1  + newline;
  25.     together+= "Partner2 = " + name2 + " Partner2 GPN = " + gpn2  + newline;
  26.     together+= "Partner3 = " + name3 + " Partner3 GPN = " + gpn3  + newline;
  27.     together+= "Partner4 = " + name4 + " Partner4 GPN = " + gpn4  + newline;
  28.     together+= "Partner5 = " + name5 + " Partner5 GPN = " + gpn5  + newline;
  29.     together+= "Partner6 = " + name6 + " Partner6 GPN = " + gpn6  + newline;
  30.     String(together);
  31.     mailto = "mailto:" + email + "?subject=" + subject + "&body=" + together;
  32.     getURL(mailto,"_self" );
  33.     }
  34. }
  35.  
  36. on (release) {
  37.     getURL("javascript:window.close()");
  38. }
  39.  


so basically, all those checkboxes, if one is left blank they want nothing for that or value to show.

Yes, i know it probably isn't the most effecient way to do it and the site is no no on php, so that's why I am doing it this way.

Any help would be greatly appreciated.
  • Flanders
  • Beginner
  • Beginner
  • User avatar
  • Posts: 48
  • Loc: Reno, Nevada US

Post 3+ Months Ago

Check the value of the checkbox before adding it to the together string.


Code: [ Select ]
if(checkbox1.selected){
together += ...whatever you're putting here ...
}
  1. if(checkbox1.selected){
  2. together += ...whatever you're putting here ...
  3. }

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 11 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.