Note that there are some explanatory texts on larger screens.

plurals
  1. POForm Submit using a Javascript to invoke webflow transition, doesn't take the updated value on form
    primarykey
    data
    text
    <p>I am trying to invoke a form submit using javascript (jquery) to invoke a webflow transition. It works and the submit invokes the desired transition. But, the updated radio button values is not reflected on the model object which is posted. </p> <p>Here is the code: </p> <pre><code>&lt;form:form method="post" action="#" commandName="infoModel" name="pageForm"&gt; &lt;form:input type="input" path="testMsg" id="success" /&gt; &lt;input type="button" id="clearSelections" value="Clear Selections"&gt; &lt;div class="question"&gt; &lt;h4&gt;&lt;c:out value="${infoModel.questionInfo.description}"/&gt; &lt;/h4&gt; &lt;form:radiobuttons path="infoModel.answerId" itemValue="answerId" itemLabel="answerDescription" items="${infoModel.answers}" delimiter="&lt;br/&gt;" /&gt; &lt;/div&gt; &lt;input type="submit" name="_eventId_saveQualitativeInput" value="Save" id="save" /&gt; $(document).ready(function() { $('#tabs').tabs(); //Clear selections (copy is server-side) $('#clearSelections').click(function() { //$('input[type="radio"]').prop('checked', false); $('input[type="radio"]').removeAttr('checked'); $('#save').trigger('click'); }); }); &lt;/form:form&gt; </code></pre> <p>The form:radiobutton, generates the below html: </p> <pre><code> &lt;div class="question"&gt; &lt;h4&gt;Is this a general obligation of the entity representing a full faith and credit pledge? &lt;/h4&gt; &lt;span&gt; &lt;input type="radio" checked="checked" value="273" name="infoModel.answerId" id="infoModel.answerId1"&gt; &lt;label for="infoModel.answerId1"&gt;Yes&lt;/label&gt; &lt;/span&gt; &lt;span&gt;&lt;br&gt; &lt;input type="radio" value="274" name="infoModel.answerId" id="infoModel.answerId2"&gt; &lt;label for="infoModel.answerId2"&gt;No&lt;/label&gt; &lt;/span&gt; &lt;br&gt; &lt;span class="error"&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>The input id= "success" value is registered and when the control goes to the server, the value of input id= "success" is updated in the "infoModel" object. But the value of answerId is not updated on the "infoModel" object. </p> <p>Thoughts if i am missing something in the form:radiobutton element or if there is something else wrong? </p> <p>Thanks in advance!</p> <p>EDIT::::::: Thanks mico! that makes sense. I stripped of some of the code first time to make it precise, but i have a list which is being used for building the radio-buttons, below is the code:</p> <pre><code> &lt;c:forEach items="${infoModel.list["index"]}" var="qa" varStatus="rowCount"&gt; &lt;div class="question"&gt; &lt;h4&gt;&lt;c:out value="${question.questionInfo.description}"/&gt; &lt;/h4&gt; &lt;form:radiobuttons path="list["index"][${rowCount.index}].answerId" itemValue="answerId" itemLabel="answerDescription" items="${question.answers}" delimiter="&lt;br/&gt;" /&gt; &lt;br&gt; &lt;/div&gt; &lt;/c:forEach&gt; </code></pre> <p>Could you please suggest how i could try this one out? NOTE: The same code works on a regular form submit on click of a button of type submit. Its the javascript form submit which is not working. I also tried to do whatever i want to do in javascript and then invoke the button.trigger('click'); form got submitted but the changes made on form in my javascript didnt reflect. </p>
    singulars
    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.
 

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