2012-10-11 21 views
0

我有一個與使用Spring.AjaxEventDecoration和dijit.form.Select的問題,如果用戶從選擇框中選擇性別類型我以某種方式獲得bean中的elementID是Spring MVC?以下是我的表單:問題Spring.AjaxEventDecoration和dijit.form.Select在Spring MVC

<form:select path="sex"> 
<form:option value="MALE" label="MALE" /> 
<form:option value="FEMALE" label="FEMALE" /> 
</form:select> 
<script type="text/javascript"> 
    Spring.addDecoration(new Spring.ElementDecoration({ 
    elementId : "sex", 
    widgetType : "dijit.form.Select", 
    widgetAttrs : { 
    promptMessage : "Enter Sex", 
    required : true }})); 

    Spring.addDecoration(new Spring.AjaxEventDecoration({ 
    elementId: "sex", 
    event: "onChange", 
    formId:"customer", 
    params: {fragments:"body", _eventId: "loadSchools"}})); 
</script> 
+0

這是一個http://stackoverflow.com/questions/12859099/issue-with-springs-web-flow-form-submit-values-are-right-ajaxeventdecoration-i – rptmat57

回答

0

我修正了這個問題。我刪除了Spring.AjaxEventDecoration電話,改變了Spring.ElementDecoration以下幾點:

<script type="text/javascript"> 
          Spring.addDecoration(new Spring.ElementDecoration({ 
           elementId : "sex", 
           widgetType : "dijit.form.Select", 
           widgetAttrs : { 
           promptMessage : "Enter Sex", 
           required : true, 
           onChange : function() { 
            Spring.remoting.submitForm(
             'submit', 
             'customer', 
             {_eventId: 'sexchange', fragments:'contents'} 
            ); 
            return false; 
           } }})); 


         </script> 

我爲什麼Ajax調用沒有工作,沒有明確的100%,但我有我的項目使用此代碼現在!