You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alberto de la Cruz <ac...@borneo-software.com> on 2003/05/06 21:14:52 UTC

Form submit doesn't work -- SOLUTION

Thanks Chen, it works!!



-----Original Message-----
From: "Chen, Gin" <Gi...@NielsenMedia.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Subject: RE: Form submit doesn't work
Date: Mon, 5 May 2003 18:13:56 -0400 
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"

Change the delete to:

<html:submit value="Delete" property="submit" styleId="buttonDelete"
disabled="true" onClick="return confirmDelete()"/>

And your javascript function to:

function confirmDelete() {
    var ok = confirm("Are you sure?");
    if (ok) {
        doSubmit();
    }
    return ok;
}

-Tim

-----Original Message-----
From: Alberto de la Cruz [mailto:acruz@borneo-software.com]
Sent: Monday, May 05, 2003 6:05 PM
To: struts-user@jakarta.apache.org
Subject: Form submit doesn't work



I am trying to submit a form using javascript.

My Code:
....
                <td><html:submit value="Create" property="submit" styleId="buttonCreate" disabled="true" onClick="doSubmit()"/></td>
                <td><html:submit value="Modify" property="submit" styleId="buttonModify" disabled="true" onClick="doSubmit()"/></td>
                <td><html:submit value="Delete" property="submit" styleId="buttonDelete" disabled="true" onClick="confirmDelete()"/></td>
                <td><html:reset styleId="buttonReset"/></td>
...
<script language="JavaScript">
function confirmDelete() {
    var ok = confirm("Are you sure?");
    if (ok) {
        doSubmit();
    }
}

function doSubmit() {
    document.forms[0].alias.disabled = false;
    document.forms[0].submit();
}

</script>

It doesn't work.
Can someone tell me what is going on please?.

Note: The <html:form> tag has not a onSubmit() parameter. It works with 
it, but the form is always submitted (even if I choose NO in the confirm 
message).

Thanks in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org