473,796 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function on submit

oll3i
679 Contributor
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 2715
oll3i
679 Contributor
does it throw an error when there is a call to undefined function in javascript?
Feb 23 '08 #2
oll3i
679 Contributor
okey i solved it
thank You
Feb 23 '08 #3
gits
5,390 Recognized Expert Moderator Expert
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
7527
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 add pagination later - there aren't alot of records, for now.) 2. This main page includes separate forms near the top with submit buttons to search, add a thought, view all thoughts, etc. The action for each form is to call this same page. The...
3
4542
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 'Save as Incomplete' button is Clicked the form will be going to the "SaveAsincomplete.asp" without validation of the fields. And when the 'save as complete' is clicked certain fileds are to be validated and by the function return value, if false...
5
4644
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
6092
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 different results than when I use a javascript submit: form1.submit();. I think the javascript submit is working as it should, since I want the server to process an __EVENTTARGET posting. When I click the submit button, it does not process the...
1
2348
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" code, all submit buttons appear to be disabled. However, when the "display text" is removed, the buttons function correctly. <%@ LANGUAGE="VBSCRIPT" %> <%response.buffer=true%> <script language="javascript">
5
2040
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 the state of a particular radio button. The call is: setCheckedValue("abbr_letter", $_SESSION) Here is a snip of the code I am trying to get to work. Everything else works except for the radio button being set. I just not sure if I have...
6
11347
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 document.getElementById('whatever').submit() doesn't work in FireFox (it works in IE) because submit is now referring to the input field - not to the function. The usual "change the input's name" doesn't work because I don't have any control over the site / web app. ...
5
5804
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 pressed it removes the check but does not re-hide the submit <div> bit. The way i see it, I have 3 options: 1) To simply remove the clear for button. 2) To exclude the said checkbox from the CLEAR button function. 3) To have the CLEAR button run...
13
3615
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 this time (in fact, I don't even know if it totally works, I'm still debugging). However, the first problem is that when an error is encountered, I get my alert box, I press ok and then the form is submitted and the new data is entered into the...
7
11085
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, returns the correct info when the "checkUname" button is clicked. However, it always returns false. I want to return false ONLY if the username is taken. Original: $("#checkUname").click(function(){ var datastring=...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.