html:submit vs. html:submit onclick="submitForm()"

    Date: 12/27/06 (Web Development)    Keywords: database, jsp

    quick question for the gurus here.
    i've inherited someone's code at work.
    the page is a little form. JSP. struts.
    1 text field (date), 1 dropdown to select from. 'submit' button.
    there is validation (prior to submitting) of the date. if date is invalid, the page reloads w/out resetting the data.
    on submit, a row is written to the database. there should always be 1 row on submit.

    problem: sometimes, the page submits 2 rows.

    originally, the 'submit' button was written as
    Submit

    then it was changed to
    Submitit>

    then back to the first one.

    i've tried looking up the cases where one should/shouldn't use plain submit vs. onclick"SubmitForm()", but so far i'm coming up emptyhanded.

    could someone please explain this to me?
    thank you....

    P.S: and, of course, if someone could think of something that could be causing 2 rows to be submitted (occasionally), that would be even better. btw, the 'submit' button is only being clicked ONCE when 2 rows get created.

    UPD: it seems that occasional duplication happens only when onClick is part of the submit. when onClick is removed and it's just the submit, i can't produce the duplication no matter what. question: why is onClick causing the occasional duplication (at least in part)?

    Source: http://community.livejournal.com/webdev/380061.html

« need internet explorer... || Web Calendar... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home