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

How to submit a form onblur?

I'm trying to make sure that a form gets submitted when the person leaves
this field.

<input type="text" name="prospectNameOrId" size="50" value=""
onblur="setUserAction('Add Prospect'); document.forms[0].submit();">

In IE6, I get 'Object doesn't support this property or method'. I'm using
document.forms[0] elsewhere, and I have found examples on the web using this
syntax, so I'm not sure what the problem is. Can I not do this in onblur?

Is there a better way to do it? (I'm a Java programmer, not too experienced
in JavaScript.)

Thanks,
Wendy in Chandler, AZ

Jul 20 '05 #1
3 17695
Lee
Wendy S said:

I'm trying to make sure that a form gets submitted when the person leaves
this field.


That's not really a good idea.
There are many things that can cause a field to lose focus
before the user is finished with it.

Jul 20 '05 #2
Wendy S wrote:
I'm trying to make sure that a form gets submitted when the person leaves
this field.

<input type="text" name="prospectNameOrId" size="50" value=""
onblur="setUserAction('Add Prospect'); document.forms[0].submit();">

In IE6, I get 'Object doesn't support this property or method'. I'm using
document.forms[0] elsewhere, and I have found examples on the web using this
syntax, so I'm not sure what the problem is. Can I not do this in onblur?

Is there a better way to do it? (I'm a Java programmer, not too experienced
in JavaScript.)

Thanks,
Wendy in Chandler, AZ


Either the input is not in <form></form>, or you have an input with the NAME
attribute set to "submit".

But as has already been mentioned, what you want to do is a Bad Idea. I'm on
your page, filling out my E-mail address, I get a phone call, I have to flip to
another application to get a bit of information for the caller (or any of
hundreds of other reasons that might cause focus to be lost on the input) and it
submits my incomplete E-mail address.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #3
"Grant Wagner" <gw*****@agricoreunited.com> wrote:
you have an input with the NAME attribute set to "submit".
That's it! Thanks...
But as has already been mentioned, what you want to do is a Bad Idea.


Is onchange better? My users are apparently unable to click the inviting
little button to the right of this text field. The UI is a little weird,
it's not 'typical html form' since it's trying to duplicate something that
happens in a telnet app. Multivalue field

One way or another I must make sure that this form gets submitted when that
field is filled in. I'll play around with validation (in Struts) and a
hidden field and see if that works better.

Thanks,

--
Wendy in Chandler, AZ
Jul 20 '05 #4

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

Similar topics

5
by: Jimbo | last post by:
I am trying to right a script so that the "submit button" only appears when certain criteria has been met. I have tried putting it in an IF statement, without any luck. Maybe a function would allow...
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...
1
by: Piotr | last post by:
I have popup window (window.open) where I put any value in input field. After submit I wan to to return to the main window and get value from popup window. How to close popup window and return to...
4
by: Peloux | last post by:
Hi, I have written some htc in order to validate data in a form. most of htc are attached on 'onblur' event. Now, we would like to use the Enter Key to sublit form, so we use the following...
2
by: Mel | last post by:
i want to diable all submit_buttons untill all my form elements are populated. how can i do that ? thanks
1
by: jim whitaker | last post by:
I followed this tutorial, and I have it working. http://www.webpasties.com/xmlHttpRequest/ My question is this: After an AJAX form receives it's data from the server, how could i then submit...
4
by: Matthew256 | last post by:
How can I submit this form on criteriaBlur? <form> <input type="text" name="criteria1" onblur="criteriaBlur(this);"> </form> function criteriaBlur( obj ) { if( ... ) { //submit form }
2
by: Jason Carlton | last post by:
I have a simple form that does nothing more than let the visitor choose an image from their hard drive, and then upload it to the server. It doesn't have any other fields than the <input...
7
by: buntyindia | last post by:
Hi, I have a form in which there is a field email I have to test its valid format on field onblur event and on form submit. Now for example I have enter something invalid in the email...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...

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.