struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mansour <mansou...@yahoo.com>
Subject Re: ajax - Submit a form
Date Mon, 21 May 2007 20:46:58 GMT
No, I can not see any thing logged. Here' the whole JSP. it should give 
you an idea about what I am doing. I am trying to save/update an account 
and run a JS to disable the inputs.


<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>

<s:head theme="ajax" debug="true"></s:head>

<script type="text/javascript">
function disableInputs(flag)
{
if (flag == 'null') flag = true;
var inputs = document.getElementById("data_table");
inputs = inputs.getElementsByTagName('input');
for ( i = 0 ;i < inputs.length ; i++ )
    inputs[i].disabled = flag ;
}

function showMessage(){
    alert('test message!');
    disableInputs(true);
    }
</script>

<!-- show the account details -->

<table id="data_table" >
    <s:form id="MyData" action="/updateAccount.action"   >
        <tr>
            <td><s:label value="AccId:" /></td>
            <td><s:property value="acc.id" />
            <s:hidden name="acc.id"    value="${acc.id}" id="acc.id" /></td>
        </tr>

        <tr>
            <td><s:label value="First Name" /></td>
            <td><s:textfield name="acc.firstName" disabled="true"
                value="${acc.firstName}" /></td>
        </tr>
        <tr>
            <td><s:label value="Last Name: " /></td>
            <td><s:textfield name="acc.lastName" disabled="true"
                value="%{acc.lastName}" /></td>
        </tr>
        <tr>
        <td>
       
        <s:submit  href="/updateAccount.action" 
                value="Save from inside the form w/o ajax"    > 
        </s:submit>
       
        </td>
        </tr>
       
    </s:form>

</table>

<hr />

<script type="text/javascript" language="javascript">
dojo.event.topic.subscribe("/disableAll" , function(data, type, request) {
  showMessage();
});
</script>

<table>
    <tr>
        <td><s:a href="javascript://" 
onclick="disableInputs(false);">edit</s:a>
        <td><s:url id="ajaxSubmit" value="/updateAccount.action" ></s:url>
        <s:submit  href="%{ajaxSubmit}"   notifyTopics="/disableAll"
            theme="ajax" formId="MyData" > save </s:submit>
         </td>
    </tr>
</table>



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


Mime
View raw message