Empirisoft Home Page
Main | Register | Search | Today's Posts | | Empirisoft

Go Back   Empirisoft Support > MediaLab Questions > MediaLab: Sharing Area

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-08-2009, 10:01 AM
newell newell is offline
Lead Programmer, Empirisoft
 
Join Date: Mar 2009
Posts: 402
newell is on a distinguished road
Validating Custom Item Required Responses

[edited from support email]

I have a question about how we can go about requiring a response on a custom items with multiple radio buttons. We have two forms of this nature, each with multiple radio buttons. In the first form, MediaLab will continue returning to the form if at least one item is not checked. What we would like is for MediaLab to display an error message indicating that the form is required, not simply loop back to the form without any correcting feedback.

In the second form, subjects could continue without selecting any radio buttons and it will move on to the next form. I'd like to make the form required in some way, even if it's only for a single radio button on the form.

Any advice on how to accomplish this?

Last edited by jarvis24 : 03-24-2010 at 05:32 AM.
Reply With Quote
  #2  
Old 10-08-2009, 10:02 AM
newell newell is offline
Lead Programmer, Empirisoft
 
Join Date: Mar 2009
Posts: 402
newell is on a distinguished road
A suggestion I could make would be to look into implementing a bit of javascript into your custom item so that the fields can be properly validated before the user is allowed to continue. You may want to use google to find more information. Unfortunately, we don't currently have a sample showing how this can be done; however there seems to be a few other posts where users have noted a similar request.

The following may give a bit more insight into a solution:
www.empirisoft.com/Support/showthread.php?t=1314
www.empirisoft.com/Support/showthread.php?t=1330
www.empirisoft.com/support/showthread.php?t=222

Last edited by jarvis24 : 03-24-2010 at 05:36 AM.
Reply With Quote
  #3  
Old 10-08-2009, 10:04 AM
newell newell is offline
Lead Programmer, Empirisoft
 
Join Date: Mar 2009
Posts: 402
newell is on a distinguished road
Sample Requiring Responses

[edited from followup support email]

I have a validation script for the radio buttons working now. The only issue I find with it is that it displays an alert for each item <note from moderator: see fix below>, which would be fine if the prompts were item specific but that isn't the case. Nonetheless, we don't anticipate people skipping the entire questionnaire, so it isn't an issue and it is working as designed.

Attached you can find our sample files for future reference and use.

<attachment revised and reposted, see below>

Last edited by jarvis24 : 03-24-2010 at 05:48 AM.
Reply With Quote
  #4  
Old 03-18-2010, 06:54 PM
Don Lund Don Lund is offline
Member
 
Join Date: Mar 2010
Posts: 7
Don Lund is on a distinguished road
form validation

I downloaded the script you attached here and couldn't get it to work. In fact when I tried to run through your questionnaire, I got the "This website cannot be loaded" error message.

Does this questionnaire work for you still?

I have a workable knowledge of HTML, but am a Javascript idiot. Is it possible for you to post some directions on where variable names are, and what filename (?) should be used for the form name.

Any help with this would be much appreciated.
Reply With Quote
  #5  
Old 03-24-2010, 05:30 AM
jarvis24 jarvis24 is offline
Administrator
 
Join Date: Nov 2005
Posts: 2,749
jarvis24 has disabled reputation
Don--I've attached a revision of the previous attachment that simplifies it and takes care of the repeat feedback if more than one item is no answered. The sample que file that accompanies it also contains just this item flanked by simple instruction items so that there should be no file location issues that arise when testing it. I've also added a few comment lines that explain some of complicated looking stuff. Please let me know if it helps!
Attached Files
File Type: zip validate.zip (10.3 KB, 4 views)
Reply With Quote
  #6  
Old 03-24-2010, 05:43 AM
jarvis24 jarvis24 is offline
Administrator
 
Join Date: Nov 2005
Posts: 2,749
jarvis24 has disabled reputation
Require at least one response but not necessarily all

Note in response to the orginal post (see above), one could change the syntax in this custom item to require that just one or more questions be answered (as opposed to all). I didn't test it, but you should be able to simply replace all the instances of "||" (meaning or) with "&&" (meaning and). This would then generate the feedback message only if no questions were answered.

Last edited by jarvis24 : 03-24-2010 at 05:49 AM.
Reply With Quote
  #7  
Old 03-24-2010, 04:17 PM
Don Lund Don Lund is offline
Member
 
Join Date: Mar 2010
Posts: 7
Don Lund is on a distinguished road
Thanks for the clarifications. So I entered in this code throughout a number of different HTML questionnaire files. It works properely in 2, however in most of them I get the following error message:

An error has occurred in the script on this page.
Line: 8
Char: 5
Error: 'documnt.Q1norms.nr1.7.checked' is null or not an object
Code: 0
URL: file:///C:/MediaLab/Samples/Reciproc...%20%20%20.html

Do you want to continue running scripts on this page?

I get the above message whether the questions have been answered or not.

When I run the questionnaire I'm attaching, the Q1norms gives me the error messages while the demos works properely. They are both used by the questionnaire I'm attaching.
Attached Files
File Type: zip Validation Problem.zip (9.5 KB, 1 views)
Reply With Quote
  #8  
Old 03-24-2010, 04:46 PM
Don Lund Don Lund is offline
Member
 
Join Date: Mar 2010
Posts: 7
Don Lund is on a distinguished road
Please verify that my response with attached files was received. I don't see it here on the board yet and wanted to make sure it got sent/attached.
Reply With Quote
  #9  
Old 03-25-2010, 03:41 PM
jarvis24 jarvis24 is offline
Administrator
 
Join Date: Nov 2005
Posts: 2,749
jarvis24 has disabled reputation
Most posts with URLs in them are spam so we have them go through a moderation queue before being approved. Will take a look at your files now and see if I can tell what's going on. <minutes pass>

I just ran it and did not see the error. What do you have to do exactly to see this error message?

Last edited by jarvis24 : 03-25-2010 at 03:51 PM.
Reply With Quote
  #10  
Old 03-25-2010, 04:00 PM
jarvis24 jarvis24 is offline
Administrator
 
Join Date: Nov 2005
Posts: 2,749
jarvis24 has disabled reputation
On second look, I noticed it seems to be the 7th option it doesn't like in every case. Coincidentally you have 7 options for each item (in your Q1norms.html file). I am not a java pro, but I believe one difference between your file and the one posted before it, is that the array indices start at [0] in the earlier sample, whereas you have your indices starting at [1]. If Java likes the indices to start at 0, then maybe try referencing them as 0-6 rather than as 1-7. Also, you might try adding the first few lines of code from the previously posted sample--it will get rid of the annoying IE security message while testing your item in IE, and will also allow the MediaLab fonts and colors to be applied. i.e., as the first lines of the HTML file:
Quote:
<!-- saved from url=(0013)about:internet -->
<!-- previous line supresses security control from IE-->
<style><ml.styles></style>
<!-- previous line requests that this page uses current colours and fonts from MediaLab-->

Last edited by jarvis24 : 03-25-2010 at 04:03 PM.
Reply With Quote
  #11  
Old 03-25-2010, 07:02 PM
Don Lund Don Lund is offline
Member
 
Join Date: Mar 2010
Posts: 7
Don Lund is on a distinguished road
Thanks for taking a look at this. In general I must say I don't like using the ml.styles code with HTML questionnaires. The fonts are so large it makes it "impossible" to preview the formatting of the questions... but that's rather unimportant.

I don't have time to verify that you've fixed my problem, however I went into the code and changed the first variable to range from 0-6 instead of 1-7 as you suggested. When I ran it again and clicked submit without clicking on any radio buttons I got the proper "please answer all questions" popup that is supposed to happen.

Then I ran through the same questionnaire again and answered the first question (the one now changed to 0-6 values) and clicked submit without answering the other questions. Now the error message was the same as I posted before but it referenced the second variable - which is still valued at 1-7.

Hopefully you've solved my problem, however I must say that I find it odd that this is the cure. I guess I'll just have to recode everything later so that all my zeros are 1's for analysis purposes.

I'll post again tomorrow once I have a chance to verify that this truely is the fix.

Whats up with Java and 7's?
Reply With Quote
  #12  
Old 03-26-2010, 04:18 PM
Don Lund Don Lund is offline
Member
 
Join Date: Mar 2010
Posts: 7
Don Lund is on a distinguished road
So I believe you've solved my problems. The interesting part that doesn't exactly make sense to me is that the HTML code specifying the values for each response are now numbered 1-7 (as I would want them to be), however in the Javascript statement, I had to renumber everything so that it's 0-6. I guess the Java just accesses the results starting with item 0 no matter what the value you assign it is. For this reason, when I had it looking for item 7, there was no item there because that would actually be the 8th item the Java looks at.

I'm attaching the revised versions of the above attachments for anyone else who wants to write some validation code.
Attached Files
File Type: zip Response Validation.zip (10.6 KB, 6 views)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help creating a custom item psychfan MediaLab: General Questions 2 04-02-2010 04:53 AM
Custom item - Autosum akipaki_sf5 MediaLab: Sharing Area 16 12-06-2008 02:31 PM
Submit custom item values to responses.xls Thomas MediaLab: How Do I... 5 10-16-2008 02:01 PM
Two Custom Item Issues jasonp220 MediaLab: Troubleshooting 4 10-07-2008 03:32 PM
Validating response with custom item wagnerla MediaLab: How Do I... 1 09-02-2008 10:59 AM


All times are GMT -4. The time now is 05:09 AM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © 1997-Eternity+ Empirisoft Corporation. All rights reserved.