Yaromat validations and "on submit" behavior

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default Yaromat validations and "on submit" behavior

    have yaromat form validations set up to validate form. on submit I have
    behavior to go to a confirmation page. When form is fired yaromat is catching
    the form errors, however it is still 'going to url' which is the the
    confirmation page. Is there a quick fix for this? How can i get the form to
    recognize the two behaviors in an order instead of firing both at once?
    Thanks! :confused; code looks like this. YAROMAT GENERATED CODE:
    <meta content='JavaScript' name='vs_defaultClientScript'> <script
    language='JavaScript' type='text/JavaScript'> <!-- function MM_findObj(n, d) {
    //v4.01 var p,i,x; if(!d) d=document;
    if((p=n.indexOf('?'))>0&amp;&amp;parent.frames.len gth) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for
    (i=0;!x&amp;&amp;i<d.forms.length;i++) x=d.forms[n];
    for(i=0;!x&amp;&amp;d.layers&amp;&amp;i<d.layers.l ength;i++)
    x=MM_findObj(n,d.layers.document); if(!x &amp;&amp; d.getElementById)
    x=d.getElementById(n); return x; } function YY_checkform() { //v4.66
    //copyright (c)1998,2002 Yaromat.com var args = YY_checkform.arguments; var
    myDot=true; var myV=''; var myErr='';var addErr=false;var myReq; for (var
    i=1; i<args.length;i=i+4){ if (args[i+1].charAt(0)=='#'){myReq=true;
    args[i+1]=args[i+1].substring(1);}else{myReq=false} var myObj =
    MM_findObj(args.replace(/\[\d+\]/ig,'')); myV=myObj.value; if
    (myObj.type=='text'||myObj.type=='password'||myObj .type=='hidden'){ if
    (myReq&amp;&amp;myObj.value.length==0){addErr=true } if
    ((myV.length>0)&amp;&amp;(args[i+2]==1)){ //fromto var
    myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV >
    myMa[1]/1){addErr=true} } else if
    ((myV.length>0)&amp;&amp;(args[i+2]==2)){ var rx=new
    RegExp('^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$');if(!rx.test(myV))addErr=true;
    } else if ((myV.length>0)&amp;&amp;(args[i+2]==3)){ // date var
    myMa=args[i+1].split('#'); var myAt=myV.match(myMa[0]); if(myAt){
    var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var
    myY=myAt[myMa[3]]; var myDate=new Date(myY,myM,myD);
    if(myDate.getFullYear()!=myY||myDate.getDate()!=my D||myDate.getMonth()!=myM){add
    Err=true}; }else{addErr=true} } else if
    ((myV.length>0)&amp;&amp;(args[i+2]==4)){ // time var
    myMa=args[i+1].split('#'); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
    } else if (myV.length>0&amp;&amp;args[i+2]==5){ // check this 2
    var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,''));
    if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,'')];
    if(!myObj1.checked){addErr=true} } else if
    (myV.length>0&amp;&amp;args[i+2]==6){ // the same var myObj1 =
    MM_findObj(args[i+1]); if(myV!=myObj1.value){addErr=true} }
    } else if
    (!myObj.type&amp;&amp;myObj.length>0&amp;&amp;myOb j[0].type=='radio'){
    var myTest = args.match(/(.*)\[(\d+)\].*/i); var
    myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj; if
    (args[i+2]==1&amp;&amp;myObj1&amp;&amp;myObj1.checked&amp;&a mp;MM_findObj(args[i
    +1]).value.length/1==0){addErr=true} if (args[i+2]==2){ var
    myDot=false; for(var
    j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
    if(!myDot){myErr+='* ' +args[i+3]+'\n'} } } else if
    (myObj.type=='checkbox'){
    if(args[i+2]==1&amp;&amp;myObj.checked==false){addErr=true}
    if(args[i+2]==2&amp;&amp;myObj.checked&amp;&amp;MM_findObj(arg s[i+1]).value.leng
    th/1==0){addErr=true} } else if
    (myObj.type=='select-one'||myObj.type=='select-multiple'){
    if(args[i+2]==1&amp;&amp;myObj.selectedIndex/1==0){addErr=true} }else if
    (myObj.type=='textarea'){ if(myV.length<args[i+1]){addErr=true} }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false} } if
    (myErr!=''){alert('The required information is incomplete or contains
    errors:\t\t\t\t\t\n\n'+myErr)} document.MM_returnValue = (myErr==''); }
    function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments;
    document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2)
    eval(args+'.location=''+args[i+1]+'''); } //--> </script> </head> FORM CODE
    FOLLOWS : <td vAlign='top'>
    <form action='vacationConfirm.asp' method='post' name='frmEmail' id='frmEmail'
    onSubmit='YY_checkform('frmEmail','name','#q','0', 'Please enter your
    name.','email','#S','2','Please enter your email address. \(i.e.
    [email]joe@att.com[/email]\)','dtStart','#^\([0-9][0-9]\)\/\([0-9][0-9]\)\/\([0-9]{4}\)$#1#2#3'
    ,'3','Please enter date as
    DD/MM/YYYY','dtThrough','#^\([0-9][0-9]\)\/\([0-9][0-9]\)\/\([0-9]{4}\)$#1#2#3',
    '3','Please enter date as DD/MM/YYYY.','phone','#q','0','Please enter your
    phone number.','selectRequest','#q','1','You must select
    one.','selectCode','#q','1','You must select
    one.');MM_goToURL('parent','vacationConfirm.asp'); return
    document.MM_returnValue'> <table width='600' border='0'
    cellspacing='0' cellpadding='3'> <td
    width='184'>&amp;nbsp;</td> <td
    width='366'>&amp;nbsp;</td> <td>Your
    Name</td> <td><input name='name' type='text'
    id='name' size='45'></td> <td>Your
    email </td> <td><input name='email' type='text'
    id='email' size='45'></td> <td>I
    would like to</td> <td>
    <select name='selectRequest' id='selectRequest'>
    <option selected>-- Select One --</option>
    <option>Cancel</option> <option>Request</option>
    </select></td>
    <td>Select Payroll Code </td> <td><select
    name='selectCode' id='selectCode'> <option
    selected> -- Select Payroll Code -- </option>
    <option>AVZ (extended unpaid vacation: NCS &amp;gt; 1989)</option>
    <option>EA2 (2 hours unpaid)</option>
    <option>EA4 (4 hours unpaid)</option> <option>EA6
    (6 hours unpaid)</option> <option>EAZ (8 hours
    unpaid)</option> <option>EP2 (2 hours
    paid)</option> <option>EP4 (4 hours paid)</option>
    <option>EP6 (6 hours paid)</option> <option>EP8 (8 hours
    paid)</option> <option>EPS (full day paid; non-flex)</option>
    <option>HFS (floating holiday)</option> <option>HLS (floating holiday
    carryover)</option> <option>NX (day off) (1 day request per month
    only)</option> <option>PWS (carryover vacation)</option>
    <option>PV4 (vacation half day)</option> <option>PVS (vacation
    day)</option> <option>other (specify in 'Comment' field)</option>

    </select></td> <td>Starting Date</td>
    <td><input name='dtStart' type='text' id='dtStart'
    size='15'> enter date as DD/MM/YYYY </td>
    <td>Through Date </td> <td><input
    name='dtThrough' type='text' id='dtThrough' size='15'>
    enter date as DD/MM/YYYY </td>
    <td>Phone</td> <td><input name='phone' type='text'
    id='phone'></td> <td>Comments</td>
    <td><textarea name='comment'
    id='comment'></textarea></td> <td
    colspan='2'><div align='center'> <input
    type='submit' name='Submit' value='Submit'>

    coil Guest

  2. Similar Questions and Discussions

    1. "yaromat" vs. "on submit"
      have yaromat form validations set up to validate form. on submit I have behavior to go to a confirmation page. When form is fired yaromat is...
    2. Acrobat Form Submit error: changes VALUE="true" to "0"
      I wrote an HTML page with a form. In the form I had many inputs as in: <INPUT TYPE="radio" NAME="Q1" VALUE="true"> and <INPUT TYPE="radio"...
    3. Can actionscript change a "Button's" "Behavior"?
      While a movie is playing in "level 0" a button is pressed to launch another movie in "level 1". Is there a way to change the button that was pressed...
    4. #25366 [NEW]: form buttons of type "image" dont send "submit" $_POST variable in IE
      From: jordanolsommer at imap dot cc Operating system: Windows XP PHP version: 4.3.2 PHP Bug Type: Variables related Bug...
  3. #2

    Default Yaromat validations and "on submit" behavior

    have yaromat form validations set up to validate form. on submit I have
    behavior to go to a confirmation page. When form is fired yaromat is catching
    the form errors, however it is still 'going to url' which is the the
    confirmation page. Is there a quick fix for this? How can i get the form to
    recognize the two behaviors in an order instead of firing both at once?
    Thanks! :confused; code looks like this. YAROMAT GENERATED CODE:
    <meta content='JavaScript' name='vs_defaultClientScript'> <script
    language='JavaScript' type='text/JavaScript'> <!-- function MM_findObj(n, d) {
    //v4.01 var p,i,x; if(!d) d=document;
    if((p=n.indexOf('?'))>0&amp;&amp;parent.frames.len gth) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&amp;&amp;d.all) x=d.all[n]; for
    (i=0;!x&amp;&amp;i<d.forms.length;i++) x=d.forms[n];
    for(i=0;!x&amp;&amp;d.layers&amp;&amp;i<d.layers.l ength;i++)
    x=MM_findObj(n,d.layers.document); if(!x &amp;&amp; d.getElementById)
    x=d.getElementById(n); return x; } function YY_checkform() { //v4.66
    //copyright (c)1998,2002 Yaromat.com var args = YY_checkform.arguments; var
    myDot=true; var myV=''; var myErr='';var addErr=false;var myReq; for (var
    i=1; i<args.length;i=i+4){ if (args[i+1].charAt(0)=='#'){myReq=true;
    args[i+1]=args[i+1].substring(1);}else{myReq=false} var myObj =
    MM_findObj(args.replace(/\[\d+\]/ig,'')); myV=myObj.value; if
    (myObj.type=='text'||myObj.type=='password'||myObj .type=='hidden'){ if
    (myReq&amp;&amp;myObj.value.length==0){addErr=true } if
    ((myV.length>0)&amp;&amp;(args[i+2]==1)){ //fromto var
    myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV >
    myMa[1]/1){addErr=true} } else if
    ((myV.length>0)&amp;&amp;(args[i+2]==2)){ var rx=new
    RegExp('^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$');if(!rx.test(myV))addErr=true;
    } else if ((myV.length>0)&amp;&amp;(args[i+2]==3)){ // date var
    myMa=args[i+1].split('#'); var myAt=myV.match(myMa[0]); if(myAt){
    var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var
    myY=myAt[myMa[3]]; var myDate=new Date(myY,myM,myD);
    if(myDate.getFullYear()!=myY||myDate.getDate()!=my D||myDate.getMonth()!=myM){add
    Err=true}; }else{addErr=true} } else if
    ((myV.length>0)&amp;&amp;(args[i+2]==4)){ // time var
    myMa=args[i+1].split('#'); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
    } else if (myV.length>0&amp;&amp;args[i+2]==5){ // check this 2
    var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,''));
    if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,'')];
    if(!myObj1.checked){addErr=true} } else if
    (myV.length>0&amp;&amp;args[i+2]==6){ // the same var myObj1 =
    MM_findObj(args[i+1]); if(myV!=myObj1.value){addErr=true} }
    } else if
    (!myObj.type&amp;&amp;myObj.length>0&amp;&amp;myOb j[0].type=='radio'){
    var myTest = args.match(/(.*)\[(\d+)\].*/i); var
    myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj; if
    (args[i+2]==1&amp;&amp;myObj1&amp;&amp;myObj1.checked&amp;&a mp;MM_findObj(args[i
    +1]).value.length/1==0){addErr=true} if (args[i+2]==2){ var
    myDot=false; for(var
    j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
    if(!myDot){myErr+='* ' +args[i+3]+'\n'} } } else if
    (myObj.type=='checkbox'){
    if(args[i+2]==1&amp;&amp;myObj.checked==false){addErr=true}
    if(args[i+2]==2&amp;&amp;myObj.checked&amp;&amp;MM_findObj(arg s[i+1]).value.leng
    th/1==0){addErr=true} } else if
    (myObj.type=='select-one'||myObj.type=='select-multiple'){
    if(args[i+2]==1&amp;&amp;myObj.selectedIndex/1==0){addErr=true} }else if
    (myObj.type=='textarea'){ if(myV.length<args[i+1]){addErr=true} }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false} } if
    (myErr!=''){alert('The required information is incomplete or contains
    errors:\t\t\t\t\t\n\n'+myErr)} document.MM_returnValue = (myErr==''); }
    function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments;
    document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2)
    eval(args+'.location=''+args[i+1]+'''); } //--> </script> </head> FORM CODE
    FOLLOWS : <td vAlign='top'>
    <form action='vacationConfirm.asp' method='post' name='frmEmail' id='frmEmail'
    onSubmit='YY_checkform('frmEmail','name','#q','0', 'Please enter your
    name.','email','#S','2','Please enter your email address. \(i.e.
    [email]joe@att.com[/email]\)','dtStart','#^\([0-9][0-9]\)\/\([0-9][0-9]\)\/\([0-9]{4}\)$#1#2#3'
    ,'3','Please enter date as
    DD/MM/YYYY','dtThrough','#^\([0-9][0-9]\)\/\([0-9][0-9]\)\/\([0-9]{4}\)$#1#2#3',
    '3','Please enter date as DD/MM/YYYY.','phone','#q','0','Please enter your
    phone number.','selectRequest','#q','1','You must select
    one.','selectCode','#q','1','You must select
    one.');MM_goToURL('parent','vacationConfirm.asp'); return
    document.MM_returnValue'> <table width='600' border='0'
    cellspacing='0' cellpadding='3'> <td
    width='184'>&amp;nbsp;</td> <td
    width='366'>&amp;nbsp;</td> <td>Your
    Name</td> <td><input name='name' type='text'
    id='name' size='45'></td> <td>Your
    email </td> <td><input name='email' type='text'
    id='email' size='45'></td> <td>I
    would like to</td> <td>
    <select name='selectRequest' id='selectRequest'>
    <option selected>-- Select One --</option>
    <option>Cancel</option> <option>Request</option>
    </select></td>
    <td>Select Payroll Code </td> <td><select
    name='selectCode' id='selectCode'> <option
    selected> -- Select Payroll Code -- </option>
    <option>AVZ (extended unpaid vacation: NCS &amp;gt; 1989)</option>
    <option>EA2 (2 hours unpaid)</option>
    <option>EA4 (4 hours unpaid)</option> <option>EA6
    (6 hours unpaid)</option> <option>EAZ (8 hours
    unpaid)</option> <option>EP2 (2 hours
    paid)</option> <option>EP4 (4 hours paid)</option>
    <option>EP6 (6 hours paid)</option> <option>EP8 (8 hours
    paid)</option> <option>EPS (full day paid; non-flex)</option>
    <option>HFS (floating holiday)</option> <option>HLS (floating holiday
    carryover)</option> <option>NX (day off) (1 day request per month
    only)</option> <option>PWS (carryover vacation)</option>
    <option>PV4 (vacation half day)</option> <option>PVS (vacation
    day)</option> <option>other (specify in 'Comment' field)</option>

    </select></td> <td>Starting Date</td>
    <td><input name='dtStart' type='text' id='dtStart'
    size='15'> enter date as DD/MM/YYYY </td>
    <td>Through Date </td> <td><input
    name='dtThrough' type='text' id='dtThrough' size='15'>
    enter date as DD/MM/YYYY </td>
    <td>Phone</td> <td><input name='phone' type='text'
    id='phone'></td> <td>Comments</td>
    <td><textarea name='comment'
    id='comment'></textarea></td> <td
    colspan='2'><div align='center'> <input
    type='submit' name='Submit' value='Submit'>

    coil Guest

  4. #3

    Default Re: Yaromat validations and "on submit" behavior

    Please do not start another thread with the same question, it makes it
    harder for folks to help you appropriately as well as others to find the
    resolution of the issue. .

    Refer to your original question:
    [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=190&threadid=971828[/url]

    --
    Danilo Celic
    | Extending Knowledge Daily : [url]http://CommunityMX.com/[/url]
    | Team Macromedia for Dreamweaver : [url]http://macromedia.com/go/team/[/url]
    danilocelic *TMM* Guest

Posting Permissions

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

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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139