This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi, this is for a Browsergame i'am playing in an ally. We're programming a report tool to keep the ally-mates better informed about ones combats.
Ok, it's about a village where a combat took place: the village always has one troup of the defender and none, one or two support troups. The troups are grouped by tribes.
The "reporter" has 3 selectboxes, where he has to pick the tribes of the participants from. The choices have to be exclusive. If the defender e.g. has Romans, support 1 + 2 must not have them. If defender=germans and support1=gauls and there is a support2, support2 has to be roman. The selectboxes will have the following names and keys-value-pairs: Defender
0=Please Select
1=Romans
2=Germans
3=Gauls
Support1
0=Please Select
1=Romans
2=Germans
3=Gauls
Support2
0=Please Select
1=Romans
2=Germans
3=Gauls
The tool will validate the input with JavaScript, but this doesn't matter here. It's rather about the puzzle, how to solve the validation with the shortest, firmest code cb [ February 19, 2005: Message edited by: Chris Baron ]
Rachel Swailes
Ranch Hand
Joined: May 18, 2004
Posts: 434
posted
0
What about instead of validating after the user's selection - limit the selection that the user can make. For example, if he selects Gauls in defender then remove Gauls from the other selection boxes.
Chris Baron
Ranch Hand
Joined: Mar 21, 2003
Posts: 1049
posted
0
Hi Rachel, i had this idea too, but gave it up, because it's very confusing if one wants to change the selections. I have an "onChange" validation with an array at the moment. Simplified:
It's working fine, but i wonder how to solve this mathematically. cb [ February 23, 2005: Message edited by: Chris Baron ]
Eugene Lucash
Ranch Hand
Joined: Feb 19, 2005
Posts: 77
posted
0
I wandering, who needs a mathematical model when solution is simple enouph in terms of object manipulation and behaviours?
Warren Dew
blacksmith
Ranch Hand
Joined: Mar 04, 2004
Posts: 1328
posted
0
A variant on Rachel's suggestion: disable the radio buttons rather than making them disappear entirely.