Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: How to uncheck one checkbox if some other is checked

by Anonymous Monk
on Aug 09, 2012 at 21:19 UTC ( [id://986614]=note: print w/replies, xml ) Need Help??


in reply to Re: How to uncheck one checkbox if some other is checked
in thread How to uncheck one checkbox if some other is checked

I guess I skimmed your question a bit too fast, as I noticed you were asking for radiobutton-like behaviour. That is somewhat more difficult to implement, but my function's button-disabling behaviour might suffice.

Indeed, as the monk below me said, for immediate feedback, you need JS. It, however, would not hurt to just say somewhere on the UI that the "E" button, if checked, overrides the others; you will need to just implement it in code then.

# If 'E' box is checked, then ignore the others my @checked = $qry->param("GRU$Za"); if (grep { $_ eq 'E' } @checked) { @checked = ('E'); }

Replies are listed 'Best First'.
Re^3: How to uncheck one checkbox if some other is checked
by SerZKO (Beadle) on Aug 10, 2012 at 05:53 UTC
    Hej Anonimous monk and thanks for your reply,

    That's an excellent idea to check it on submission. The thing is that if neither of "P", "F" or "K" is checked then "Ej" should be checked and vice versa - if any(or more) of "P", "F" or "K" are checked then "Ej" must not be checked.

    Anyhow, thanks for pointing to that direction

      That would be something like this, then.

      my %checked = map { $_ => 1 } $qry->param("GRU$Za"); if (keys %checked > 1) { delete $checked{'E'}; } elsif (keys %checked == 0) { %checked = ('E' => 1); }

      I'd still document it in the UI; it sounds like behaviour that is likely to cause confusion.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://986614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-19 03:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found