473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 2698
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

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

Similar topics

1
by: Jenkins | last post by:
I've loaded various thoughts I've collected into mysql. I want to write an app, all in one file, that has the following features: 1. On initial entry, selects and displays the thoughts ( might...
3
by: Varun | last post by:
Hi There, I have a form("myRequest.asp") and the values from it are retrieved into the page ("output_Print.asp") on which I have two buttons('Save As Complete' and 'Save As Incomplete'). When the...
5
by: mike | last post by:
If I have a document like: <script> function mike_test() {alert('hi');} </script> <iframe src="blank.html" id="my_iframe1"> </iframe> and in blank.html I have:
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
1
by: devine | last post by:
Hi All, I have a form which checks which Submit button has been pressed and also shows a textarea dependant on an option selected. The problem I have is that when I include my "display text"...
5
by: IchBin | last post by:
Not sure if I should post this to a javascript group or here. So I'll try here first since most here mix both in this group. I am trying to pass a php value into a JavaScript function that changes...
6
by: yawnmoth | last post by:
I'm trying to write a so-called bookmarklet for a specific web app and am having some difficulty. One of the names of a specific forms inputs is submit. As such, doing...
5
by: plumba | last post by:
Ok, another query.... I have a checkbox at the bottom of my form which when checked unhides a <div> block which displays the submit button. The problem I have is when the clear form button is...
13
by: Andrew Falanga | last post by:
HI, Just a warning, I'm a javascript neophyte. I'm writing a function to validate the contents of a form on a web page I'm developing. Since I'm a neophyte, this function is quite simple at...
7
Haitashi
by: Haitashi | last post by:
I have a form that calls a function using the onClick event in the submit button. I would like this function to return false if the username is taken. The the original function, which I've tested,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.