my javascript function doesnt work on submit? -
-
<form method="post" action="" name="client_form" onsubmit="return checkForm(this,<?echo $number ?>,<?echo $language?>);">
-
-
-
function checkForm(form,number,language){
-
-
var images=new Array("AzBd1X","BdYC8o","Ug6iYp");
-
-
if(images[number]!=form.confirmation.value){
-
if(language=="polish") form.confirmation.value = "***Prosze wpisać poprawny kod!";
-
else form.confirmation.value = "***Please enter the right code!";
-
return false;
-
}
-
-
var email1= form.email1.value;
-
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-
if (!filter.test(email1)) {
-
if(language=="polish")
-
form.email1.value="***Proszę wpisać poprawny email!";
-
else form.email1.value="***Please enter the right email!";
-
return false;
-
}
-
-
var email2= form.email2.value;
-
-
if (!filter.test(email2)) {
-
if(language=="polish")
-
form.email2.value="***Proszę wpisać poprawny email!";
-
-
else form.email2.value="***Please enter the right email!";
-
return false;
-
}
-
-
-
-
if(!form.email1.value==form.email2.value){
-
-
if(language=="polish")
-
form.email2.value="***Proszę wpisać poprawny email!";
-
-
else form.email2.value="***Please enter the right email!";
-
return false;}
-
-
-
-
-
if(form.name.value.length==0 || form.name.value=="***Proszę wpisać Imię i Nazwisko" || form.name.value=="***Please enter firstname and lastname" ){
-
-
if(language=="polish")
-
-
form.email2.value="***Proszę wpisać Imię i Nazwisko";
-
-
else form.email2.value="***Please enter firstname and lastname";
-
-
return false;
-
}
-
-
if(form.phone.value.length==0 || form.phone.value=="***Prosze wpisać numer telefonu" || form.phone.value=="***Please enter phone number"){
-
if(language=="polish")
-
-
form.phone.value="***Proszę wpisać numer telefonu";
-
-
else form.phone.value="***Please enter phone number";
-
return false;
-
}
-
-
if(form.email1.value.length==0 || form.email1.value=="***Proszę wpisać email" || form.email1.value=="***Please enter email"){
-
if(language=="polish")
-
form.email1.value="***Proszę wpisać email";
-
else form.email1.value="***Please enter email";
-
return false;}
-
-
if(form.email2.value.length==0 || form.email2.value=="***Proszę wpisać email" || form.email2.value=="***Please enter email"){
-
if(language=="polish")
-
form.email2.value="***Proszę wpisać email";
-
else form.email2.value="***Please enter email";
-
return false;}
-
-
-
if(form.company_name.value.length==0 || form.company_name.value=="***Proszę wpisać nazwę firmy" || form.company_name.value=="***Please enter company name"){
-
if(language=="polish")
-
form.company_name.value="***Proszę wpisać nazwę firmy";
-
else form.company_name.value="***Please enter company name";
-
return false;}
-
-
-
-
if(form.country.selectedIndex== 0){
-
hide_show('client_insert_alert_location');
-
return false;}
-
-
if(form.sector.selectedIndex== 0){
-
hide_show('client_insert_alert_sector');
-
return false;}
-
-
-
return true;
-
}
-
-
maybe You will find why
thank You
3 2715
does it throw an error when there is a call to undefined function in javascript?
okey i solved it
thank You
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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:
|
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...
|
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">
| |
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...
|
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. ...
|
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...
|
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...
|
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=...
|
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...
| |
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,...
|
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |