Show off your HTML/Javascript cleverness
Ben Vinnerd
ben at vinnerd.com
Sun Aug 31 19:29:19 BST 2014
Quick way would probably be to write some JS to clear/unset the radio
buttons where the user clicks one that would conflict with them.
e.g. User clicks Course 1/T1, then Course 1/T2. The 1st radio button that
the user selected (course 1/T1) would now be cleared/unset.
The flash looking solution would be to use some CSS to highlight the
background of conflicting selections with red.
Ben
On 31 August 2014 12:14, Dave Cross <dave at dave.org.uk> wrote:
>
> I need some HTML/Javascript help.
>
> See http://dave.org.uk/grid.html.
>
> On this page you have a list of courses (Course 1 to Course 6) and three
> time periods (T1 to T3). The idea is that each person will select one
> course for each of the three time periods.
>
> I have it set up so that each time period has a set of radio buttons
> associated with it (one for each course). This ensures that each person can
> select only one course per time period. But it doesn't stop them from
> selecting the same course for all three time periods - which I don't want
> to allow.
>
> Then there's course 6. Course 6 runs across all time periods. If you
> select course 6 then you can't select any more courses.
>
> I guess I need to write some Javascript that enforces these extra
> rules[1]. But I thought that the clever people in london.pm might have
> some clever ideas. So I'm asking you first.
>
> How would you implement this?
>
> Dave...
>
> [1] And, yes, I know I'd need to implement the same checks server-side as
> well.
>
> --
> Dave Cross :: dave at dave.org.uk
> http://dave.org.uk/
> @davorg
>
More information about the london.pm
mailing list