Spring WebFlow2 JavaScript未提交页面?
Spring WebFlow2 JavaScript未提交页面 我正试图使用WebFlow2附带的SpringJavaScript,在用户单击其中一个单选按钮时提交带有转换值的页面。我插入了我的javascript,但是点击时页面没有被提交 JSP:Spring WebFlow2 JavaScript未提交页面?,java,spring,spring-mvc,spring-webflow,spring-js,Java,Spring,Spring Mvc,Spring Webflow,Spring Js,Spring WebFlow2 JavaScript未提交页面 我正试图使用WebFlow2附带的SpringJavaScript,在用户单击其中一个单选按钮时提交带有转换值的页面。我插入了我的javascript,但是点击时页面没有被提交 JSP: Spring 3.0 MVC-Web流示例 客户注册 姓名: 春天 .add装饰(新春元素装饰)( { elementId:“名称”, widgetType:“dijit.form.ValidationTextBox”, WidgeAttrs:{
Spring 3.0 MVC-Web流示例
客户注册
姓名:
春天
.add装饰(新春元素装饰)(
{
elementId:“名称”,
widgetType:“dijit.form.ValidationTextBox”,
WidgeAttrs:{
promptMessage:“这是您希望输入到系统中的名称。”
}
}));
电话号码:
春天
.add装饰(新春元素装饰)(
{
elementId:“电话号码”,
widgetType:“dijit.form.ValidationTextBox”,
WidgeAttrs:{
提示信息:“这是上述姓名的电话号码”
}
}));
行:
行:B
行:A
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:“行”,
formId:“客户”,
事件:“onChange”,
参数:{
_eventId:“加载学校”,
片段:“身体”
}
}));
Spring.addDecoration(new Spring.validatealdecoration({
elementId:'继续',
事件:“onclick”
}));
尝试为每行输入不同的id,如下所示:
<td><form:radiobutton value="B" path="row" id="rowB" />Row: B<BR>
<form:radiobutton value="A" path="row" id="rowA" />Row: A<BR>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId : "rowA",
formId : "customer",
event : "onChange",
params : {
_eventId : "loadSchools",
fragments : "body"
}
}));
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId : "rowB",
formId : "customer",
event : "onChange",
params : {
_eventId : "loadSchools",
fragments : "body"
}
}));
</script></td>
行:B
行:A
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:“罗瓦”,
formId:“客户”,
事件:“onChange”,
参数:{
_eventId:“加载学校”,
片段:“身体”
}
}));
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:“rowB”,
formId:“客户”,
事件:“onChange”,
参数:{
_eventId:“加载学校”,
片段:“身体”
}
}));
这是我的代码的一部分,正在运行(表单被提交),它使用select而不是radiobutton,但思路相同。选择值时,它会自动提交表单并更新值:
<form:form commandName="dateRange">
...
<select name="fyForDR" id="fyForDR" class='discretFont' style='margin-left:10px;margin-right:10px;'>
<option value="" selected='selected'>Fiscal Year</option>
<option value="2011" <c:if test="${fyForDR == '2011'}">selected="selected"</c:if> >FY11</option>
<option value="2010" <c:if test="${fyForDR == '2010'}">selected="selected"</c:if> >FY10</option>
<option value="2009" <c:if test="${fyForDR == '2009'}">selected="selected"</c:if> >FY09</option>
<option value="2008" <c:if test="${fyForDR == '2008'}">selected="selected"</c:if> >FY08</option>
<option value="2007" <c:if test="${fyForDR == '2007'}">selected="selected"</c:if> >FY07</option>
<option value="2006" <c:if test="${fyForDR == '2006'}">selected="selected"</c:if> >FY06</option>
</select>
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId: "fyForDR",
event: "onchange",
formId:"dateRange",
params: {fragments:"body", _eventId: "setFy"}
}));
</script>
...
</form:form>
...
会计年度
2011财年
2010财年
2009财年
2008财年
2007财年
FY06
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId:“fyForDR”,
事件:“onchange”,
formId:“日期范围”,
参数:{fragments:“body”,_eventId:“setFy”}
}));
...
这是流定义的一部分:
<view-state id="dateRangeForm" model="dateRange">
...
<transition on="setFy" validate="false" >
<set name="viewScope.fyForDR" value="requestParameters.fyForDR"/>
<evaluate expression="dateRange.setStartDate(dateRangeService.getFyStartDate(viewScope.fyForDR))"></evaluate>
<evaluate expression="dateRange.setEndDate(dateRangeService.getFyEndDate(viewScope.fyForDR))"></evaluate>
</transition>
...
</view-state>
...
...
谢谢,但我正在使用单选按钮,而且它看起来只在第一次单击单选按钮时才起作用。它是否起作用?你把onchange和onclick都放进去了吗?还有装饰都放进去了吗?不,不,不工作。。。。我把onchange和onclick都放进去了,它只在你点击第一个单选按钮时才起作用。。。。
<view-state id="dateRangeForm" model="dateRange">
...
<transition on="setFy" validate="false" >
<set name="viewScope.fyForDR" value="requestParameters.fyForDR"/>
<evaluate expression="dateRange.setStartDate(dateRangeService.getFyStartDate(viewScope.fyForDR))"></evaluate>
<evaluate expression="dateRange.setEndDate(dateRangeService.getFyEndDate(viewScope.fyForDR))"></evaluate>
</transition>
...
</view-state>