469,361 Members | 2,207 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

function on submit

oll3i
679 512MB
my javascript function doesnt work on submit?

Expand|Select|Wrap|Line Numbers
  1.  
  2. <form method="post" action="" name="client_form"  onsubmit="return checkForm(this,<?echo $number ?>,<?echo $language?>);">
  3.  
Expand|Select|Wrap|Line Numbers
  1.  
  2. function checkForm(form,number,language){
  3.  
  4. var images=new Array("AzBd1X","BdYC8o","Ug6iYp");
  5.  
  6. if(images[number]!=form.confirmation.value){
  7.    if(language=="polish") form.confirmation.value = "***Prosze wpisać poprawny kod!";
  8.    else form.confirmation.value = "***Please enter the right code!";
  9. return  false;
  10. }
  11.  
  12. var email1= form.email1.value;
  13. var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  14. if (!filter.test(email1)) {
  15.     if(language=="polish")
  16.     form.email1.value="***Proszę wpisać poprawny email!";
  17.     else form.email1.value="***Please enter the right email!";
  18. return  false;             
  19. }
  20.  
  21. var email2= form.email2.value;
  22.  
  23.     if (!filter.test(email2)) {
  24.          if(language=="polish")
  25.          form.email2.value="***Proszę wpisać poprawny email!";
  26.  
  27.          else form.email2.value="***Please enter the right email!";
  28. return false;         
  29. }  
  30.  
  31.  
  32.  
  33.     if(!form.email1.value==form.email2.value){
  34.  
  35.          if(language=="polish")
  36.          form.email2.value="***Proszę wpisać poprawny email!";
  37.  
  38.          else form.email2.value="***Please enter the right email!"; 
  39. return  false;}
  40.  
  41.  
  42.  
  43.  
  44.     if(form.name.value.length==0 || form.name.value=="***Proszę wpisać Imię i Nazwisko" ||  form.name.value=="***Please enter firstname and lastname" ){
  45.  
  46.         if(language=="polish")
  47.  
  48.         form.email2.value="***Proszę wpisać Imię i Nazwisko";
  49.  
  50.         else form.email2.value="***Please enter firstname and lastname";
  51.  
  52. return  false;
  53. }
  54.  
  55. if(form.phone.value.length==0 || form.phone.value=="***Prosze wpisać numer telefonu" || form.phone.value=="***Please enter phone number"){
  56.         if(language=="polish")
  57.  
  58.         form.phone.value="***Proszę wpisać numer telefonu";
  59.  
  60.         else form.phone.value="***Please enter phone number";
  61. return  false;
  62. }
  63.  
  64. if(form.email1.value.length==0 || form.email1.value=="***Proszę wpisać email" || form.email1.value=="***Please enter email"){
  65.     if(language=="polish")
  66.     form.email1.value="***Proszę wpisać email";
  67.     else form.email1.value="***Please enter email";
  68. return  false;}
  69.  
  70. if(form.email2.value.length==0 || form.email2.value=="***Proszę wpisać email" || form.email2.value=="***Please enter email"){
  71.     if(language=="polish")
  72.     form.email2.value="***Proszę wpisać email";
  73.     else form.email2.value="***Please enter email";
  74. return  false;}
  75.  
  76.  
  77. if(form.company_name.value.length==0 || form.company_name.value=="***Proszę wpisać nazwę firmy" || form.company_name.value=="***Please enter company name"){
  78.     if(language=="polish")
  79.     form.company_name.value="***Proszę wpisać nazwę firmy";
  80.     else form.company_name.value="***Please enter company name";
  81. return  false;}
  82.  
  83.  
  84.  
  85. if(form.country.selectedIndex== 0){
  86. hide_show('client_insert_alert_location');
  87. return false;}
  88.  
  89. if(form.sector.selectedIndex== 0){
  90. hide_show('client_insert_alert_sector');
  91. return false;}
  92.  
  93.  
  94. return true;
  95. }
  96.  
  97.  
maybe You will find why
thank You
Feb 23 '08 #1
3 2525
oll3i
679 512MB
does it throw an error when there is a call to undefined function in javascript?
Feb 23 '08 #2
oll3i
679 512MB
okey i solved it
thank You
Feb 23 '08 #3
gits
5,390 Expert Mod 4TB
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
Feb 25 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Jenkins | last post: by
5 posts views Thread by mike | last post: by
10 posts views Thread by ljlolel | last post: by
5 posts views Thread by IchBin | last post: by
6 posts views Thread by yawnmoth | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.