View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05424Bug reportsSurvey takingpublic2012-03-14 21:08
Reporteruser15398Assigned ToTMSWhite  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.91+ 
Fixed in Version1.92RC4 
Summary05424: validation fails on mandatory comment field in list(radio)
Description

When you don't enter text in the mandatory field you will still pass and go to the next page.

Steps To Reproduce
  • Create a question,
  • type list (radio)
  • option other: yes
  • mandatory: yes

Open the question, choose other, don't fill in anything at the comment
click next, you will get alerted that you did not fill out the mandatory field, but nevertheless, the form is submitted and you go to the next page.

Additional Information

I extensively searched myself, saw a few things that might be related. I consider it a bit remarkable to submit a form in the onclick event of a button of type submit. Is not necessary and I should not recommend this. If you do so the form onsubmit with a false return does not stop the form from being submitted. If you remove it, behavior is OK, BUT, now the buttons get greyed out and you cannot go on, I think because of jquery doing something.

After many hours of testing this seems to be very complicated. I've worked with phpsurvyer since the 0.9 series and I get a it frightened by all the complexity that has been introduced. Fancy is nice, but working and understandable code is even nicer.

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)10120
I will donate to the project if issue is resolvedNo
Browserfirefox
Database type & versionmysql
Server OS (if known)linux
Webserver software & version (if known)apache
PHP Version5

Users monitoring this issue

There are no users monitoring this issue.

Activities

tpartner

tpartner

2011-09-05 18:54

partner   ~16231

jwajwa, are you using the latest release? As far as I know the redundant submit function has already been removed from the onclick event.

TMSWhite

TMSWhite

2012-01-20 17:07

reporter   ~16873

This works fine in 1.92 RC as long as you do not use a custom "Label for 'Other:' option" that required EM-based tailoring.

Here is the default JavaScript:
<script type='text/javascript'>
<!--
oldonsubmitOther_57 = document.limesurvey.onsubmit;
function ensureOther_57()
{
othercboxval=document.getElementById('answer26626X3X57othercbox').checked;
otherval=document.getElementById('answer26626X3X57other').value;
if (otherval != '' || othercboxval != true) {
if(typeof oldonsubmitOther_57 == 'function') {
return oldonsubmitOther_57();
}
}
else {
alert('You\'ve marked the \u0022other\u0022 field for question \u0022[M] All the other questions will filter on this one\u0022. Please also fill in the accompanying \u0022other comment\u0022 field.');
return false;
}
}
document.limesurvey.onsubmit = ensureOther_57;
-->
</script>

However, this is broken in 1.92 RC2 if you use a custom "Label for 'Other:' option".

Although the proper JavaScript is created, the alert tries to include a <span> element so that it can dynamically tailored. This needs to be re-factored into EM to be a "validation" message that will appear as a color-coded tip rather than a pop-up message.

Here is the generated JavaScript:
<script type='text/javascript'>
<!--
oldonsubmitOther_70 = document.limesurvey.onsubmit;
function ensureOther_70()
{
othercommentval=document.getElementById('answer26626X6X70othertext').value;
otherval=document.getElementById('SOTH26626X6X70').checked;
if (otherval == true && othercommentval == '') {
alert('You\'ve selected the \u0022<span id='LEMtailor_Q_70_275'></span>\u0022 answer for question \u0022[L] List drop-down\u0022. Please also fill in the accompanying \u0022other comment\u0022 field.');
return false;
}
else {
if(typeof oldonsubmitOther_70 == 'function') {
return oldonsubmitOther_70();
}
}
}
document.limesurvey.onsubmit = ensureOther_70;
-->
</script>

TMSWhite

TMSWhite

2012-02-03 08:59

reporter   ~17199

Fixed in revision 12322

c_schmitz

c_schmitz

2012-02-14 14:10

administrator   ~17425

1.92RC4 released

Related Changesets

LimeSurvey: Yii 959f488b

2012-02-03 00:01:43

TMSWhite

Details Diff
Fixed issue 05424: validation fails on mandatory comment field in list(radio)
Dev removed all onsubmit popup alerts saying that other comment had to be filled. Replaced with EM-based validation and CSS styling to indicate that the other comment needs to be filled.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12323 b72ed6b6-b9f8-46b5-92b4-906544132732
Affected Issues
05424
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/helpers/qanda_helper.php Diff File
mod - templates/basic/template.css Diff File
mod - templates/bluengrey/template.css Diff File
mod - templates/citronade/template.css Diff File
mod - templates/clear_logo/template.css Diff File
mod - templates/default/template.css Diff File
mod - templates/eirenicon/template.css Diff File
mod - templates/limespired/template.css Diff File
mod - templates/mint_idea/template.css Diff File
mod - templates/sherpa/template.css Diff File
mod - templates/vallendar/template.css Diff File

Issue History

Date Modified Username Field Change
2011-08-26 11:42 user15398 New Issue
2011-08-26 11:42 user15398 Status new => assigned
2011-08-26 11:42 user15398 Assigned To => lemeur
2011-08-26 15:16 lemeur Assigned To lemeur => c_schmitz
2011-08-26 15:16 lemeur Category Conditions => Survey taking
2011-09-02 00:28 c_schmitz Assigned To c_schmitz => user9586
2011-09-05 18:54 tpartner Note Added: 16231
2012-01-20 17:07 TMSWhite Note Added: 16873
2012-01-20 17:07 TMSWhite Assigned To user9586 => TMSWhite
2012-01-20 17:07 TMSWhite Status assigned => confirmed
2012-02-03 08:59 TMSWhite Note Added: 17199
2012-02-03 08:59 TMSWhite Status confirmed => resolved
2012-02-03 08:59 TMSWhite Fixed in Version => 1.92RC4
2012-02-03 08:59 TMSWhite Resolution open => fixed
2012-02-14 14:10 c_schmitz Note Added: 17425
2012-02-14 14:10 c_schmitz Status resolved => closed
2012-03-14 21:08 TMSWhite Changeset attached => Import 2012-03-09 13:30:34 Yii 959f488b