function on submit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    function on submit

    my javascript function doesnt work on submit?

    [code=javascript]

    <form method="post" action="" name="client_fo rm" onsubmit="retur n checkForm(this, <?echo $number ?>,<?echo $language?>);">
    [/code]

    [code=javascript]

    function checkForm(form, number,language ){

    var images=new Array("AzBd1X", "BdYC8o","Ug6iY p");

    if(images[number]!=form.confirma tion.value){
    if(language=="p olish") form.confirmati on.value = "***Prosze wpisać poprawny kod!";
    else form.confirmati on.value = "***Please enter the right code!";
    return false;
    }

    var email1= form.email1.val ue;
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(e mail1)) {
    if(language=="p olish")
    form.email1.val ue="***Proszę wpisać poprawny email!";
    else form.email1.val ue="***Please enter the right email!";
    return false;
    }

    var email2= form.email2.val ue;

    if (!filter.test(e mail2)) {
    if(language=="p olish")
    form.email2.val ue="***Proszę wpisać poprawny email!";

    else form.email2.val ue="***Please enter the right email!";
    return false;
    }



    if(!form.email1 .value==form.em ail2.value){

    if(language=="p olish")
    form.email2.val ue="***Proszę wpisać poprawny email!";

    else form.email2.val ue="***Please enter the right email!";
    return false;}




    if(form.name.va lue.length==0 || form.name.value =="***Proszę wpisać Imię i Nazwisko" || form.name.value =="***Please enter firstname and lastname" ){

    if(language=="p olish")

    form.email2.val ue="***Proszę wpisać Imię i Nazwisko";

    else form.email2.val ue="***Please enter firstname and lastname";

    return false;
    }

    if(form.phone.v alue.length==0 || form.phone.valu e=="***Prosze wpisać numer telefonu" || form.phone.valu e=="***Please enter phone number"){
    if(language=="p olish")

    form.phone.valu e="***Proszę wpisać numer telefonu";

    else form.phone.valu e="***Please enter phone number";
    return false;
    }

    if(form.email1. value.length==0 || form.email1.val ue=="***Proszę wpisać email" || form.email1.val ue=="***Please enter email"){
    if(language=="p olish")
    form.email1.val ue="***Proszę wpisać email";
    else form.email1.val ue="***Please enter email";
    return false;}

    if(form.email2. value.length==0 || form.email2.val ue=="***Proszę wpisać email" || form.email2.val ue=="***Please enter email"){
    if(language=="p olish")
    form.email2.val ue="***Proszę wpisać email";
    else form.email2.val ue="***Please enter email";
    return false;}


    if(form.company _name.value.len gth==0 || form.company_na me.value=="***P roszę wpisać nazwę firmy" || form.company_na me.value=="***P lease enter company name"){
    if(language=="p olish")
    form.company_na me.value="***Pr oszę wpisać nazwę firmy";
    else form.company_na me.value="***Pl ease enter company name";
    return false;}



    if(form.country .selectedIndex= = 0){
    hide_show('clie nt_insert_alert _location');
    return false;}

    if(form.sector. selectedIndex== 0){
    hide_show('clie nt_insert_alert _sector');
    return false;}


    return true;
    }

    [/code]
    maybe You will find why
    thank You
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #2
    does it throw an error when there is a call to undefined function in javascript?

    Comment

    • oll3i
      Contributor
      • Mar 2007
      • 679

      #3
      okey i solved it
      thank You

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        Originally posted by oll3i
        does it throw an error when there is a call to undefined function in javascript?
        of course it throws an error :) what else should happen? but glad to hear you got it working ...

        kind regards

        Comment

        Working...