Do I need hidden buttons for each transition in Spring WebFlow2 on my form?
Do I need hidden buttons for each transition in Spring WebFlow2 on my form?
I am starting to not like Spring WebFlow2 if this is true. Someone is telling me I need a hidden button for each transition I would like my form to have. Example If I have a form with a submit and reset I understand I should use two buttons.
But if I have a form that needs to kick off a transition to load some data on the form do I really need a button for each transition type? I would found this crazy but is it true?
He is my store. I have a form that the user starts to fill out and once the user clicks on a radio button I need to load a number of schools into a dropdown for the user to pick. The only way I found to do this is to use javascript and a hidden button to kick off the loadschool transition type. example:
Code:
<INPUT value="Load Schools" type="submit" name="_eventId_loadSchools" style="visibility:hidden">
Is this the best way?
Is this the only way?
Do I really need a button for each transition?
My Flow:
Code:
<view-state id="SchoolVisitReport" view="SchoolVisitReport.jsp" model="visit" >
<transition on="submit" to="addVisit">
<evaluate expression="flowActions.validateVisit(visit, messageContext)"/>
</transition>
<transition on="loadSchools" to="SchoolVisitReport" >
<evaluate expression="flowActions.initializeSelectableSchools(visit)" result="flowScope.selectableSchools"/>
</transition>
<transition on="cancel" to="endState" bind="false"/>
</view-state>
My JavaScript:
Code:
function loadSchools(strBorough)
{
alert("Loading Schools for borough " + strBorough);
document.visit._eventId_loadSchools.click();
}
My Radio Buttons:
Code:
<form:radiobutton tabIndex="9" onchange='loadSchools();' value="B" path="borough" />Bronx-X<BR>
<form:radiobutton tabIndex="10" onchange='loadSchools();' value="K" path="borough" />Kings-K<BR>
<form:radiobutton tabIndex="11" onchange='loadSchools();' value="M" path="borough" />Man.-M<BR>
So can someone please tell me if I am doing this the right and best way with webflow2.. thanks
I also tried the following but nothing got submitted:
Code:
<script type="text/javascript">
Spring.addDecoration(new Spring.AjaxEventDecoration({
elementId : "borough",
formId : "visit",
event : "onChange",
params : {
_eventId : "loadSchools",
fragments : "body"}
}));
</script>