Required=false not working for one question


Author
Message
jeff.smith
jeff.smith
Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)
Group: Forum Members
Posts: 33, Visits: 190
Hello,

"/ required = false" is not working for the attached script. I MUST put in a value for the first of 2 questions, but I can leave the second blank.

Ideas?

Jeff
Attachments
214124125125125.iqx (536 views, 1.00 KB)
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
The specified /range creates an implicit response requirement (it implements a regular expression under the hood). Since that regex doesn't match the empty string, you can't move past the 1st instance of the <openended> without providing a response within the specified range. That effect then carries over to the 2nd instance (although it arguably shouldn't), which allows you to leave the 2nd response blank.

At any rate, the best way to go about this would be to explicitly specify a regex via /mask that matches either the empty string "" or an integer value between 0 and 100 (inclusive):

<openended HHpercent>
/ required=false
/ stimulusframes = [1=HHpercent]
/ mouse=false
/ position= (50, 50)
/ mask = (^$)|^(100|[1-9]?[0-9])$
/ numlines = 1
/ linelength = 4
/ buttonlabel = "Press ENTER to Continue"
</openended>

That should cover all the cases and allow for blank responses in both.

jeff.smith
jeff.smith
Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)Distinguished Member (3.9K reputation)
Group: Forum Members
Posts: 33, Visits: 190
Very cool :D Thanks, Dave!

Bonus: This solved another problem I was having for a textbox element as well that I wanted to restrict to either leaving blank or integers between 0 and 75.

Also just to note in the help file under mask attribute the following link requires a login:

"For example, see http://utilitymill.com/utility/Regex_For_Range for a tool that generates expressions constraining input to a range of integer values."


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search