homepage Welcome to WebmasterWorld Guest from 54.243.23.129
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
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




msg:1476315
 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




msg:1476316
 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




msg:1476317
 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




msg:1476318
 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




msg:1476319
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved