Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submitting a form directly from a field (recognizing characters)...

Status
Not open for further replies.

bgreenhouse

Technical User
Feb 20, 2000
231
CA
Hi all

I have a form setup that has an image being used as the submit button (not using the input type="image", but an anchor over an image that initiates a validation function). I am now trying to have that sequence initiated as soon as a user enters data into the final field and hits enter (to simulate the feeling people are used to in forms). I have seen some scripts in this forum that deal with this by character recognition, but I'm not sure if that's the best way to deal with it, and all of their scripts seem to deal with NS/IE problems. Also, they are a bit convoluted and I have trouble deciphering them enough to adapt them to my uses. I guess I'm really asking two questions: is character recognition the best way to solve my problem, and - if so - how would I go about doing that?

Thanks

Ben
 
I should also mention that I heard there were problems with character recognition only working in Netscape, not IE...is this true, and if so how do people get around it?
 
I am unclear exactly what your question is, could you give some more info about the problem? What do you want character recognition for exactly? Is it that you don't want to have a submit button at all?
(call formName.submit())

Cheers, Ben "Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer"
 
Hi Bangers

I want to be able to submit the form by pressing enter when you are done filling in the last text field...(character recognition to recognize the enter key...)

Ben
 
You could do this super easily, as a temp measure just by having an invisible button which functions as the submit button, but calls validate function, you could also use some onKeyPress I guess, but I will investigate this further!

See if the invisible button works:

<input type=&quot;button&quot; style=&quot;visibility:hidden&quot; ...>

And just make sure it recieves focus when you want, i.e. after the last textfield. Sorry about these half measures, but I will have a look tomorrow..

P.s. apologies if I am barking up the wrong tree!

-Ben. &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer&quot;
 
&quot;I want to be able to submit the form by pressing enter when you are done filling in the last text field...&quot; --> if there is also a submit button in your form, it has the focus in an automatic way and therefore you don't need to code anything !!!!! if you don't have a submit button then banger's idea is the one.
 
Yes but for some reason he wants to hide it! By the way iza, I would like to extend thanks to you for the term Netscrap! Sums it up beautifully!

-Ben
&quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer&quot;
 
> I would like to extend thanks to you for the term Netscrap! Sums it up beautifully!

Ok, now it's just gone way to far!!! I was using the term 'Nutscrap' here in TT two years ago and was asked to stop as it offended someone !!! Now not only am I singled out to stop, but others receive accolades for the same behavior < dirt rotten sour grapes > %-( AAAAaaaaahhhhhh!

If you don't see me posting any longer you will know I've been banished for using the 'NASTY' term again. Sorry Dave but I just had to say something. Actually I'm not at all put out by this, all though, it is interesting how things work out sometimes.

-pete
 

Palbano, apologies, no harm intended, I just needed to vent my frustrations, and was glad to discover I was not the only one with this requirement. As juvenile as is it is, using terms like these allows me the perceived ability to scrape a meagre slurry of power back.

- You will not see the term Netscrap or Nutscrap again, however you will know what I am thinking.

-Ben
&quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer&quot;
 
&quot;Now not only am I singled out to stop, but others receive accolades for the same behavior &quot; --> i'm a girl with a nice smile that's why people forgive me anything O:)
come on palbano i won't use that term again i didn't know you were banished fot such things !! well i didn't tought anyone could be offended with such terms ...
anyway i'll never understand people who bannish instead of dicussing, i'm sad there are such people here in tt
 
Alright, alright...you guys got off topic ;-)

What I'm trying to do is to get an image I am using as a submit button (using the image tag and the onclick event, not the input type=image tag) to functiona s a submit button in that when you hit return at the end of the form, it is automatically submitted. Is that clear? LEt me know if it isn't...

Ben
 
very clear... I have never been able to trap key events for the enter key jared@aauser.com
 
I think you should investigate an invisible button! &quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer&quot;
 

I think you should investigate an invisible button!Or perhaps onBlur of the final text field could trigger the method call (provided validation conditions are met)?
&quot;Alright whatever man, I'll hook up the hair, but I aint touchin the ring though...Cause I'm still a pla--yer&quot;
 
> Is that clear? LEt me know if it isn't...

So your looking for a red 98 Chevy 4x4 with a barden bumper, right? :)

Anyway this works in IE but not in N... because 'the other' browser does not support 'onclick' in a 'img' tag

<form name=&quot;form1&quot; action=&quot;junk.asp&quot;>
<img onclick=&quot;document.form1.submit();&quot;
src=&quot;/Research/images/folderClose.jpg&quot;>

Hope this helps
-pete
 
if the fields are supposed to be filled in order, maybe you could autosubmit the form using the onchange event for the last field to be filled
this is a cross browser solution ! (-:

and sorry for the garbage/off topic part ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top