473,657 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="imagesButt ons/
purchaseButton_ r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton_ r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton_ r2_c2.jpg'"
onClick="JavaSc ript:document.f orms[0].submit()">

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

onSubmit="WAVal idateAN(documen t.checkout_AN_L oc.x_first_name ,document.check out_AN_Loc.x_fi rst_name.value, '-
Invalid character in first
name',true,true ,false,true,'', document.checko ut_AN_Loc.x_fir st_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 2824
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="imagesButt ons/
purchaseButton _r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton _r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton _r2_c2.jpg'"
onClick="JavaS cript:document. forms[0].submit()">

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

onSubmit="WAVa lidateAN(docume nt.checkout_AN_ Loc.x_first_nam e,document.chec kout_AN_Loc.x_f irst_name.value ,'-
Invalid character in first
name',true,tru e,false,true,'' ,document.check out_AN_Loc.x_fi rst_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.f orms[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="imagesButt ons/
purchaseButton_ r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton_ r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton_ r2_c2.jpg'"
onClick="JavaSc ript:document.f orms[0].submit()">
That works but the problem is before I was using a <input
type="submit"an d this did the validation I set up like this
onSubmit="WAVal idateAN(documen t.checkout_AN_L oc.x_first_name ,document.chec* kout_AN_Loc.x_f irst_name.value ,'-
Invalid character in first
name',true,true ,false,true,'', document.checko ut_AN_Loc.x_fir st_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.f orms[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...@Creativen ess.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="imagesButt ons/
purchaseButton_ r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton_ r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton_ r2_c2.jpg'"
onClick="JavaSc ript:document.f orms[0].submit()">

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

onSubmit="WAVal idateAN(documen t.checkout_AN_L oc.x_first_name ,document.check out_AN_Loc.x_fi rst_name.value, '-
Invalid character in first
name',true,true ,false,true,'', document.checko ut_AN_Loc.x_fir st_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="imagesButt ons/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.javas cript:
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="imagesButt ons/
purchaseButton_ r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton_ r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton_ r2_c2.jpg'"
onClick="JavaSc ript:document.f orms[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.f orm.submit()'
That works but the problem is before I was using a <input
type="submit"an d this did the validation I set up like this
onSubmit="WAVal idateAN(documen t.checkout_AN_L oc.x_first_name ,document.c
heckout_AN_Loc. x_first_name.va lue,'- Invalid character in first
name',true,true ,false,true,'', document.checko ut_AN_Loc.x_fir st_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...@Creativen ess.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="imagesButt ons/
purchaseButton_ r2_c2.jpg" onMouseOver="th is.src = 'imagesButtons/
purchaseButton_ r2_c2_f2.jpg'" onMouseOut="thi s.src = 'imagesButtons/
purchaseButton_ r2_c2.jpg'"
onClick="JavaSc ript:document.f orms[0].submit()">
That works but the problem is before I was using a <input
type="submit"an d this did the validation I set up like this
onSubmit="WAVal idateAN(documen t.checkout_AN_L oc.x_first_name ,document..chec k*out_AN_Loc.x_ first_name.valu e,'-
Invalid character in first
name',true,true ,false,true,'', document.checko ut_AN_Loc.x_fir st_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="imagesButt ons/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
2222
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 earth it's failing - I'm getting a "Object doesn't suppport this property or method" Line 32 char 5 when i attempt to change the location, have looked all over for answers and not found anything on the net or in the js ref docs i have - any...
6
2715
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: when the user clicks a button in the main window, a dialog window pops up. In the dialog the user enters a university to search for. When the string is submitted, the dialog then shows all the matches found in the database. The user picks one and...
6
4037
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 on it... (Kinda like a menu, you make your choice from) But since this table can get very long, I've put something of a 'search-form' on top, which enables the user to make a
1
1870
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" ControlToValidate="txtTest" Runat="server" Text="*" Display="Dynamic" ErrorMessage="Enter Value" /> <asp:ValidationSummary DisplayMode="BulletList" Runat="server"/> <asp:Button Text="Submit" ID="Submit" Runat="server"/>
0
1880
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 have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
4
1407
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. Added to a project on development machine (Win XP Pro, IIS 5.1, CLR 1.1.4322), works fine. Deployed to a shared web host (IIS 5.1, CLR 1.1.4322), works fine. Added to different project on same development machine, works fine. Deployed to 2nd...
5
2538
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 am never get passed the isset($_POST) after selecting an item in the dropdownlist. I have coded a simple script to duplicate what I am trying to do, just to make sure i understand it, and that works. This is the code and has to be something...
31
15341
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 blank.....the problem now is when i leave the text boxes blank the message appears...and when i click ok...then instead of showing me the page its giving me an exception--> type Exception report message description The server encountered an...
2
3148
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 message as in alert box as " Internet Explorer cannot open the Internet site http://google.citycarrentals.com.au/viewalllocations.php . Operation aborted". It is working in Mozilla . Here i mentioned my code . I am facing this problem several...
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
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...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
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
4159
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...
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.