homepage Welcome to WebmasterWorld Guest from 54.166.96.101
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
give regular button same interface as a submit button
icpooreman

5+ Year Member



 
Msg#: 5037 posted 5:39 am on Feb 20, 2006 (gmt 0)

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

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



 
Msg#: 5037 posted 5:49 am on Feb 20, 2006 (gmt 0)

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

Can it be changed to a submit button?

a1call

10+ Year Member



 
Msg#: 5037 posted 5:54 am on Feb 20, 2006 (gmt 0)

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

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



 
Msg#: 5037 posted 7:07 am on Feb 20, 2006 (gmt 0)

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

5+ Year Member



 
Msg#: 5037 posted 2:32 pm on Feb 20, 2006 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved