View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05708Bug reportsSurvey takingpublic2012-03-14 21:08
ReporterTMSWhite Assigned ToTMSWhite  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.92RC3 
Target Version1.92RC4Fixed in Version1.92RC4 
Summary05708: Questions that fail validation criteria are colored red before user ever gets to it
Description

this can be confusing, making them think they've done something wrong.

Steps To Reproduce

ls2_validation_survey.lss

Additional Information

[18:38] <c_schmitz> something is still weired
[18:38] <c_schmitz> I am using _dev
[18:38] <c_schmitz> and imported the LS2 Validation Samples survey
[18:39] <c_schmitz> I activate it, start it and submit the first question page without filling anything
[18:40] <c_schmitz> on the second page the 'Multi-Flex 1-10' question is marked red
[18:41] <c_schmitz> because I did not fill anything, which is weird because I see the page for the first time and the question is not mandatory anyway
[18:41] <c_schmitz> It also says 'Please select between and answer(s)
[18:41] <c_schmitz> Each answer must be between 0 and 0'
[18:41] <c_schmitz> weird
[18:42] <TMSWhite> if you look at the logic file, you'll see that the min/max answers and min/max values are set on the first page
[18:42] <c_schmitz> yeah, but why showing this in red eventhough I have not submitted the page yet
[18:43] <TMSWhite> That's related to another issue discussed on bug 5698 - EM validates everything with every onchange event
[18:43] <TMSWhite> ideally, it should only validate questions after you have visited them (so when the focus is on a later question)
[18:44] <TMSWhite> That sounds like a good idea, but would require some augmentations to the logic to only change the validation colors if focus is after the current question
[18:45] <TMSWhite> well - really, any time focus has passed the current question - validation should not disappear just because focus changes to an earlier question
[18:45] <c_schmitz> I don't think that is a good idea, maybe it is just a matter of presentation/CSS - I would not expect anything to be red that is not mandatory, just because it is not mandatory
[18:45] <TMSWhite> but ultimately, the issue is whether that should be handled by changes to EM logic, CSS, or both
[18:46] <TMSWhite> ah - the red there shows that the entry fails the validation tests, not that it is mandatory
[18:46] <TMSWhite> thus, perhaps pink would be better
[18:46] <TMSWhite> or a CSS class that would let people style it as they see fit
[18:47] <TMSWhite> try some of the validation tests on the next page - like entering bad email addresses or phone numbers - that changes the background color of the cell
[18:47] <c_schmitz> definately something with a CSS class
[18:47] <c_schmitz> adding color:red directly is like hardcoding
[18:48] <TMSWhite> I know, thus the discussion about classes
[18:48] <c_schmitz> yeah
[18:50] <c_schmitz> validating everyhing on onchange is fine, I guess
[18:51] <TMSWhite> (the benefit of validating on change is that it ensures that cascading validation works properly)
[18:51] <c_schmitz> yes
[18:51] <TMSWhite> But, keeping the style changes related to validation from annoying users would be nice.
[18:55] <c_schmitz> I think we need to make a difference between 'on the fly validation' and 'submit error'
[18:55] <c_schmitz> the on the fly validation should be more subtle
[18:55] <TMSWhite> I presume that could be done via CSS classes?
[18:55] <c_schmitz> but if on submit responses are no properly filled out the hint should get bright
[18:56] <c_schmitz> yes
[19:01] <TMSWhite> So, what do you think for the more subtle way of on-the-fly validation errors?
[19:01] <c_schmitz> Keep the text and background in almost the same colors
[19:01] <TMSWhite> Also, I don't want a regression - in 1.91, you do use green and red to show the min/max sum value conditions are met
[19:01] <TMSWhite> for multiple-numeric questions
[19:01] <c_schmitz> but only for the sum
[19:02] <c_schmitz> let me check
[19:02] <TMSWhite> true - it just seemed like such a nice solution I tried to extend it.
[19:02] <c_schmitz> I think it was only for the sum value
[19:02] <c_schmitz> in general I think it is a great idea, will enhance usability
[19:03] <c_schmitz> I just felt like I did already something wrong when I saw the page for the first time ;)
[19:03] <c_schmitz> with all the red stuff ;)
[19:03] <TMSWhite> very good point
[19:03] <TMSWhite> I should at least put default values on the first page
[19:05] <TMSWhite> Since I can add a qseq attribute to questions, it should be possible to only conditionally change the validation class if the current focus has passed the gseq of the question being validated.
[19:05] <TMSWhite> that would avoid having things look invalid before you get to the question
[19:05] <c_schmitz> Yes, it is the usually not seen/not touched/not answered
[19:05] <c_schmitz> problem

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)12232
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMysql 5.3
Server OS (if known)Windows XP
Webserver software & version (if known)XAMPP
PHP Version5.3

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-01-27 20:26

reporter   ~17038

[[Mazi]]

Hmm... maybe something like "#F75D59" -> Indian Red1 at www.computerhope.com/htmcolor.htm

TMSWhite

TMSWhite

2012-01-28 05:39

reporter   ~17044

Last edited: 2012-01-28 05:39

This is a lot trickier than it might seem. I factored out the validation equations into one per question to make the rest of this easier, but here's what didn't work:
(1) Only call validation if document.activeElement is later on the page than the validation equation. Although this worked, it didn't work if submit and have invalid questions to report.
(2) Only call validation onchange or onclick - rather than changing qanda, tried to detect which question had changed from within ExprMgr_process_relevance_and_tailoring() - but if click to a new element rather than tab, that didn't work. Might work if attached to qanda instead.
(3) Only call validation for active question - that didn't work if clicked to make focus somewhere else
(4) Bind a function to the question div to add onblur events to all input elements and have them fire the validation on the question if the new focus wasn't part of the question. The binding process worked, but the validation results didn't work as desired.

So, reverting to just validating everything every time, for now.

Incidentally, this may need to be re-visited for question-level em_validation_q. If people wanted to use AJAX calls to validate questions, they don't want it happening every time something else changes.

TMSWhite

TMSWhite

2012-02-03 00:24

reporter   ~17196

Fixed in revision 12320

c_schmitz

c_schmitz

2012-02-14 14:10

administrator   ~17426

1.92RC4 released

Related Changesets

LimeSurvey: Yii dcbf04d8

2012-02-02 15:26:10

TMSWhite

Details Diff
Fixed issue 05708: Questions that fail validation criteria are colored red before user ever gets to it
Dev On first visit, invalid question are color-coded a pleasant warning color. After submit, if still invalid, they are flagged in red (using .input-error class)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12321 b72ed6b6-b9f8-46b5-92b4-906544132732
Affected Issues
05708
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
2012-01-27 20:23 TMSWhite New Issue
2012-01-27 20:23 TMSWhite Status new => assigned
2012-01-27 20:23 TMSWhite Assigned To => TMSWhite
2012-01-27 20:26 TMSWhite Note Added: 17038
2012-01-28 05:39 TMSWhite Note Added: 17044
2012-01-28 05:39 TMSWhite Note Edited: 17044
2012-02-02 17:36 user16774 Issue Monitored: user16774
2012-02-03 00:24 TMSWhite Note Added: 17196
2012-02-03 00:24 TMSWhite Status assigned => resolved
2012-02-03 00:24 TMSWhite Fixed in Version => 1.92RC4
2012-02-03 00:24 TMSWhite Resolution open => fixed
2012-02-14 14:10 c_schmitz Note Added: 17426
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 dcbf04d8