Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring WebFlow2 Javascript only working on first radio button
    primarykey
    data
    text
    <p>Spring WebFlow2 Javascript only working on first radio button</p> <p>I am trying to use Spring JavaScript that comes with WebFlow2 to submitted my page with a transition value if the user clicks on one of the radio buttons. </p> <p>I inserted my javascript on the page using onclick and onchange and it only works if the first radio button is selected. I dont know why but I think I tried everything... can someone please tell me if this is a issue with Spring JavaScript.</p> <p>JSP:</p> <pre><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Spring 3.0 MVC - Web Flow Example&lt;/title&gt; &lt;script type="text/javascript" src="&lt;c:url value="/resources/dojo/dojo.js" /&gt;"&gt; &lt;/script&gt; &lt;script type="text/javascript" src="&lt;c:url value="/resources/spring/Spring.js" /&gt;"&gt; &lt;/script&gt; &lt;script type="text/javascript" src="&lt;c:url value="/resources/spring/Spring-Dojo.js" /&gt;"&gt; &lt;/script&gt; &lt;link type="text/css" rel="stylesheet" href="&lt;c:url value="/resources/dijit/themes/tundra/tundra.css" /&gt;" /&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;Customer Registration&lt;/h2&gt; &lt;form:form commandName="customer" id="customer"&gt; &lt;input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" /&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="name" /&gt;&lt;/font&gt;&lt;b&gt;Name: &lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;form:input path="name" id="name" /&gt; &lt;script type="text/javascript"&gt; Spring .addDecoration(new Spring.ElementDecoration( { elementId : "name", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : { promptMessage : "This is the name you would like entered into the system." } })); &lt;/script&gt; &lt;br /&gt; &lt;p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;font color=red&gt;&lt;form:errors path="phoneNumber" /&gt;&lt;/font&gt; &lt;b&gt;Phone number: &lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;form:input path="phoneNumber" id="phoneNumber" /&gt;&lt;br /&gt; &lt;script type="text/javascript"&gt; Spring .addDecoration(new Spring.ElementDecoration( { elementId : "phoneNumber", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : { promptMessage : "This is the phone number for the above name" } })); &lt;/script&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;b&gt;Row:&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;form:radiobutton value="B" path="row" id="rowBtn" /&gt;Row: B&lt;BR&gt; &lt;form:radiobutton value="A" path="row" id="rowBtn" /&gt;Row: A&lt;BR&gt; &lt;script type="text/javascript"&gt; Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: "rowBtn", event: "onchange", formId:"customer", params: {fragments:"body", _eventId: "proceed"} })); &lt;/script&gt; &lt;script type="text/javascript"&gt; Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: "rowBtn", event: "onclick", formId:"customer", params: {fragments:"body", _eventId: "proceed"} })); &lt;/script&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Year of Birth:&lt;/td&gt; &lt;td&gt; &lt;form:select path="byear"&gt; &lt;form:option value="2012" label="2012" /&gt; &lt;form:option value="2011" label="2011" /&gt; &lt;form:option value="2010" label="2010" /&gt; &lt;/form:select&gt; &lt;script type="text/javascript"&gt; Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId: "byear", event: "onchange", formId:"customer", params: {fragments:"body", _eventId: "proceed"} })); &lt;/script&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;input type="submit" name="_eventId_proceed" value="proceed" id="proceed" /&gt; &lt;input type="submit" name="_eventId_cancel" value="Cancel" /&gt; &lt;/form:form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload