Hi Richard,

Glad that was useful. :-)

> I've tried multiple things to coerce the
> value out of the cell but so far have not had much luck.  Any hints?

There are lots of ways to go.  Nich's answer is pretty easy to drop
into the function I gave you, though you might rename "cells" to
"grades" (and the "cell" parameter to the anonymous function with
"grade"), being sure to update the var statement, and replace this

        cells = row.select('td.relevant');


        grades = row.select('input[id^=grade]');

...at which point this

            val = parseInt(cell.innerHTML);


            val = parseInt(grade.getValue());

...which calls the Form.Element#getValue method[1] on each input.

[1] http://prototypejs.org/api/form/element/getValue

Or if you're using IDs for all this stuff, a different approach
entirely, based on IDs, might be called for.  That would be more in
line with Walter's suggestion [$F(id) is basically $(id).getValue()].

(I'm curious about the ID "grade1".  Is that the first grade in the
row for a given student?  E.g., Joe has grade1, grade2, grade3, etc.?
If so, how are they differentiated from Nitin's grades in the next
row?  IDs have to be unique.)

Anyway, hope this gets you going.
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Jan 14, 1:00 am, RNHurt <rnh...@gmail.com> wrote:
> T.J.,
> Thank you for the extraordinary help - your script worked right off
> the bat!  The only thing I'm struggling with right now is the fact
> that the cells I want to calculate are not just numbers but <form>
> elements.  So, cell.innerHTML is something like <input id="grade1"
> value="20"> instead of "20".  I've tried multiple things to coerce the
> value out of the cell but so far have not had much luck.  Any hints?
> Thanx!
>   Richard
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to