Welcome to WebmasterWorld Guest from 54.226.32.234

Forum Moderators: open

Message Too Old, No Replies

give regular button same interface as a submit button

     

icpooreman

5:39 am on Feb 20, 2006 (gmt 0)

10+ Year Member



hey I created a form that submits data with ajax the problem is that I want the user to be able to send this data when they hit enter not just when they click on the button how can I get this effect.

DrDoc

5:49 am on Feb 20, 2006 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



What is the code for the button?
<input type="button">?

Can it be changed to a submit button?

a1call

5:54 am on Feb 20, 2006 (gmt 0)

10+ Year Member



Hi,
I had a similar problem where a form had a js "onClick" submit button and I needed pressing enter submit as well. The only work around that worked was that I put a submit input in the form that I hid by using div at absolute negative pixels. I don't know anything about Ajax, but it might work. Keep in mind that negative div might trigger a hidden text red flag with SEs. The page I did this on still has PR and is cached By SEs.

DrDoc

7:07 am on Feb 20, 2006 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I would recommend replacing the <input type="button"> with <input type="submit"> and then use the form's
onsubmit
attribute to trigger whatever JavaScript you want to run. Just remember to return false to prevent the form from submitting.

icpooreman

2:32 pm on Feb 20, 2006 (gmt 0)

10+ Year Member



Thanks that just returning false was the type of thing I was looking for. Now it acts like a submit button without actually submitting the form.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month