473,320 Members | 1,936 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,320 software developers and data experts.

Problem with Javascript submit

I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.

<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">

That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this

onSubmit="WAValidateAN(document.checkout_AN_Loc.x_ first_name,document.checkout_AN_Loc.x_first_name.v alue,'-
Invalid character in first
name',true,true,false,true,'',document.checkout_AN _Loc.x_first_name,
0,true);">

Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this. I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.

Apr 5 '07 #1
5 2806
Rabel scribed:
>I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.

<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">

That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this

onSubmit="WAValidateAN(document.checkout_AN_Loc.x _first_name,document.checkout_AN_Loc.x_first_name. value,'-
Invalid character in first
name',true,true,false,true,'',document.checkout_A N_Loc.x_first_name,
0,true);">

Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this. I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.
I'm a js newbie as well, but my experience is that when using
"document.forms[0].submit()" in a js, it doesn't effect the onSubmit
directive. It doesn't appear to me that the js directive replaces the submit
button, but merely submits the form according to the action directive.

My workaround has been to write a small js that submits the form for
validation and if it validates, submit it.
--
Ed Jay (remove 'M' to respond by email)
Apr 5 '07 #2
On Apr 5, 1:42 pm, Ed Jay <e...@aes-intl.comwrote:
Rabel scribed:


I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.
<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">
That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this
onSubmit="WAValidateAN(document.checkout_AN_Loc.x_ first_name,document.chec*kout_AN_Loc.x_first_name. value,'-
Invalid character in first
name',true,true,false,true,'',document.checkout_AN _Loc.x_first_name,
0,true);">
Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this. I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.

I'm a js newbie as well, but my experience is that when using
"document.forms[0].submit()" in a js, it doesn't effect the onSubmit
directive. It doesn't appear to me that the js directive replaces the submit
button, but merely submits the form according to the action directive.

My workaround has been to write a small js that submits the form for
validation and if it validates, submit it.
--
Ed Jay (remove 'M' to respond by email)- Hide quoted text -

- Show quoted text -
Thanks Ed - so could I then just move the code to the "submit" button
then

Apr 5 '07 #3
On Apr 5, 1:21 pm, "Rabel" <R...@Creativeness.comwrote:
I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.

<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">

That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this

onSubmit="WAValidateAN(document.checkout_AN_Loc.x_ first_name,document.checkout_AN_Loc.x_first_name.v alue,'-
Invalid character in first
name',true,true,false,true,'',document.checkout_AN _Loc.x_first_name,
0,true);">

Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this. I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.
the "proper" way to use an image as the submit button is to use a tag
like this:

<input type="image" src="imagesButtons/purchaseButton_r2_c2.jpg" />

Put that in the form and it should act the way you want it to, and
that should also make your onSubmit code run when it's supposed to.
You should also be able to put the same onMouseOver and onMouseOut
codes into that tag.

And, yes, when you call something like form.submit() in the
javascript, the onSubmit code that you put in the form tag will
(should?) not run.

Apr 5 '07 #4
Rabel wrote on 05 apr 2007 in comp.lang.javascript:
I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.

<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">
with onclick do not use the javascript: part, [unless you also use
clientside vbscript on the same page].

If th <imgis in the form, use:

onClick='this.form.submit()'
That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this
onSubmit="WAValidateAN(document.checkout_AN_Loc.x_ first_name,document.c
heckout_AN_Loc.x_first_name.value,'- Invalid character in first
name',true,true,false,true,'',document.checkout_AN _Loc.x_first_name,
0,true);">
Oh, that is a string I cannot possibly fathom, keep your questions simple
please.

onsubmit='' belongs in the <formelement and NOT in an <input/submit
where you should use onclick=''.

If you put the onsubmit='' in the form element, it will fire BOTH with a
submit buttom AND with a javascript submit.

However you could, in stead of a <img also use a
<input type='image' for regular submission.

Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this.
Either it works, or it does not, meseems?
I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
See above.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.
Learn to use CSS.

Perhaps you should first study the beginnings of html-forms, javascript
and css, examples and tutorials are all over the web. Google is your
friend.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 5 '07 #5
On Apr 5, 2:17 pm, brunas...@gmail.com wrote:
On Apr 5, 1:21 pm, "Rabel" <R...@Creativeness.comwrote:


I am a flash designer so I dont know a whole lot about the javascript
submit buttons (I may not even be describing it right sorry) but here
is the code I am using.
<IMG name="Checkout" value="Checkout" SRC="imagesButtons/
purchaseButton_r2_c2.jpg" onMouseOver="this.src = 'imagesButtons/
purchaseButton_r2_c2_f2.jpg'" onMouseOut="this.src = 'imagesButtons/
purchaseButton_r2_c2.jpg'"
onClick="javascript:document.forms[0].submit()">
That works but the problem is before I was using a <input
type="submit"and this did the validation I set up like this
onSubmit="WAValidateAN(document.checkout_AN_Loc.x_ first_name,document..check*out_AN_Loc.x_first_name .value,'-
Invalid character in first
name',true,true,false,true,'',document.checkout_AN _Loc.x_first_name,
0,true);">
Now there is a whole lot of text I cut out so if the code is a little
off dont worry - it works fine, but I dont know how to make it call
this. I thought since that I have told the form to submit and the form
is told that on submit do the validation - any help is apprieciated.
Also with the button there is no mouse change (to rollover mouse
state) any idea how I change that.

the "proper" way to use an image as the submit button is to use a tag
like this:

<input type="image" src="imagesButtons/purchaseButton_r2_c2.jpg" />

Put that in the form and it should act the way you want it to, and
that should also make your onSubmit code run when it's supposed to.
You should also be able to put the same onMouseOver and onMouseOut
codes into that tag.

And, yes, when you call something like form.submit() in the
javascript, the onSubmit code that you put in the form tag will
(should?) not run.- Hide quoted text -

- Show quoted text -
Thanks brunas that works - thanks for the help

Apr 5 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DB | last post by:
Hi All Having stared at this all morning and altered various things with no effect other then to exasperate the problem i'm wondering if anyone could take a look at the code below and see why on...
6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
6
by: Joop | last post by:
Hi all, I'm kinda new to JavaScript, but hey... I'm trying anyway! ;-) So, here's my problem : I've created a table in my document, presenting a list of items, one can 'select' by clicking...
1
by: CGuy | last post by:
Hi, I have the following code in my aspx page <form id="Form1" method="post" runat="server"> <asp:TextBox ID="txtTest" Runat="server" /> <asp:RequiredFieldValidator ID="valText"...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
4
by: Alphonse Giambrone | last post by:
I have a simple login page that has two text boxes, two requiredfieldvalidators, a couple of labels and a button. It has been reduced down to almost nothing to troubleshoot the below problem. ...
5
by: IchBin | last post by:
I am cross posting to comp.lang.php and alt.comp.lang.php. I am having a problem with getting a post from a dropdownlist off a html form. While debugging, by instruction steps, for some reason I...
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.