Slider doesn't return to default value after validation error
Permalink Browser Info Environment
If after form submission there is a validation issue - eg. user doesn't fill in a required field - the slider control seems to reset to 0.
I am using a slider control with a default value set to 25 and if there are any validation issues and the form is reposted the slider resets to zero.
I am pretty sure this is a bug. Any chance this could be fixed quickly - or maybe you can let me know how to fix it - I am pretty good with php and javascript.
Thanks
I am using a slider control with a default value set to 25 and if there are any validation issues and the form is reposted the slider resets to zero.
I am pretty sure this is a bug. Any chance this could be fixed quickly - or maybe you can let me know how to fix it - I am pretty good with php and javascript.
Thanks
Type: | Discussion |
---|---|
Status: | New |
I fix this now, thanks for letting me know.
Ok the quick way to fix this, if you don't mind changing two lines of code, is to changes line #755 of "packages/forms_with_paypal_payment/blocks/form_with_paypal_payment/controller.php" to this:
And then change line #765 to this:
Let me know if you have any questions. I'll add this fix to the next version of the add-on when I put out a new one.
value:' . stripslashes(htmlspecialchars(isset($_REQUEST['Question' . $msqID]) ? intval(str_replace('$', '', $val)) : $questionData['sliderDefault'])) . ',
And then change line #765 to this:
<input id="sliderAmount' . $si . '" name="Question' . $msqID . '" type="text" readonly="readonly" value="' . ($questionData['textAmount'] ? '$' : '') . stripslashes(htmlspecialchars(isset($_REQUEST['Question' . $msqID]) ? intval(str_replace('$', '', $val)) : $questionData['sliderDefault'])) . '" style="border: none; background: transparent;"><div id="hasSlider' . $si . '"></div>
Let me know if you have any questions. I'll add this fix to the next version of the add-on when I put out a new one.