[LON-CAPA-users] Any way to do this???

Mills, Douglas G dmills at illinois.edu
Thu May 24 09:59:23 EDT 2012

Hi Gerd,

Thank you. I'm giving that a try but maybe not implementing it correctly. My
code for checking the density looks like this where $$submission[0] should
be the submission for the customresponse for the mass of the water since
it's the first customresponse in this part:

<customresponse answerdisplay="$bddisplay" id="33">
    <answer type="loncapa/perl">
$bdlow=$bdanswer - $bdrange;
$bdhigh=$bdanswer + $bdrange;
if ($submission=~/\,/) { return 'EXTRA_ANSWER'; }
if ($submission=~/^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }
if ($submission!~/^[\d\.]+$/) { return 'WANTED_NUMERIC'; }
if((substr($submission,0,1) eq '0') && (length($submission)!=4)){return
if((substr($submission,0,1) ne '0') && (length($submission)!=3) &&
(index($submission, ".") != -1)){return 'SIG_FAIL'};
if((length($submission)!=2) && (index($submission, ".") == -1)){return
if(($submission>$bdlow) && ($submission<$bdhigh)){return 'APPROX_ANS'};
return 'INCORRECT';
<textline readonly="no" size="8" /> g/mL

Previously I had the first four lines of code in the script in the head of
the document and with the submission referenced as &submission(1,22). This
worked as long as I submitted each customresponse separately. However, now
that I'm combining them into one part so one submission, that approach does
not allow for evaluation of the density answers on the first submit.


On 5/24/12 8:19 AM, "Gerd Kortemeyer" <korte at lite.msu.edu> wrote:

> Hi,
> On May 24, 2012, at 9:01 AM, Mills, Douglas G wrote:
>> We¹re using custom problems to collect data from students as they do their
>> labs. I have a table in which they¹re to enter a volume of water, the mass of
>> the water and then their calculation of the density of water (and this over
>> multiple trials). Ideally, I¹d like to have them enter their data and hit
>> submit once for all their entries together. The hitch though is that of
>> course checking their calculated densities requires use of their input mass
>> and volume figures and those don¹t become available until after the page has
>> reloaded after submission.
> You have immediate access to all submissions within a custom-response:
> $$submission[0], $$submission[1], Š is an array of all values entered within a
> customresponse.
> - Gerd.
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users


Douglas Mills
Director of Instructional Technologies
Department of Chemistry
University of Illinois
dmills at illinois.edu
(217) 244-5739 

More information about the LON-CAPA-users mailing list