• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

avoid form submission

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have question regd HTML form submission, every time I refresh my form is submitted , and the data in the form changes, I need to avoid this and the form is to be submitted only if the combo box changes or the buttons are clicked in the form...which am doing thru javascript...
how can I avoid form submission during refresh...
Thanks in advance!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you add the submit event handler to your form declaration like this:
<form name="foo" method="post" onsubmit="return toggleSubmit();">
you can control whether the form gets submitted or not by returning a boolean from your method (in the example, toggleSubmit). If the method returns false, then the form will not submit. Note the return keywork in front of the method name inside the event handler. You must include return or the results of the bound method will be ignored.
Hope this helps.
--Tripp
 
zena sam
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot! it helps!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic