RE: [tclwebtest] Checking a checkbox using the value
Status: Abandoned
Brought to you by:
tils
From: Michael H. <Mic...@qu...> - 2004-01-28 15:26:57
|
Peter, Excellent! That works a treat. I also looked into the automated install = and it looks pretty robust. I won't be able to test it until I'm back on a = Unix based project. We're on Windows right now and unfortunately I'm = unlikely to find time to port your scripts. Many thanks, Michael > -----Original Message----- > From: Peter Marklund [mailto:pet...@fa...] > Sent: 28 January 2004 14:56 > To: Michael Hinds; tcl...@li... > Subject: RE: [tclwebtest] Checking a checkbox using the value >=20 >=20 > Hey Michael! > I happened to come across the need to check some checkboxes=20 > myself. It's > odd, I always assumed you could use field select for them but it = seems > you can't. However, I drafted a new proc that you can get if you cvs > update / checkout tclwebtest. Here is the proc: >=20 > ad_proc -private field_check_multiple { > checkbox_name > checkbox_values > } { > Loop over a group of checkboxes with a given name and select > those with a value matching a list of values. >=20 > @checkbox_name The name of the checkboxes to check > @checkbox_values A list of values that indicate which=20 > checkboxes to > check >=20 > @autor Peter Marklund > } { > while { 1 } { > if { [catch {field find -next ~n $checkbox_name ~t=20 > checkbox}] } { > # No more checkboxes > break > } > =20 > array set current_field [::tclwebtest::field_current] >=20 > set checkbox_value [lindex $current_field(choices) 1] > if { [lsearch -exact $checkbox_values=20 > $checkbox_value] !=3D -1 } { > field check > } else { > # field_find -next will give us the current field=20 > eternally > as > # long as it hasn't been modified so increment=20 > current field > manually > incr ::tclwebtest::current_field > } > } > } >=20 > Use it like this: >=20 > field check_multiple my_checkbox_name [list value1 value2 value3] >=20 > Peter > =20 > ---------------------------- > Peter Marklund > C/O Thomas Sch=F6nbeck > Oster Farimagsgade 77 > 2100 Copenhagen > Denmark >=20 > Work Phone: +45-33436380 > Mobile phone: +45-20820101 > Home phone: +45-35559440 > http://collaboraid.biz > http://petermarklund.com > ---------------------------- >=20 > http://fastmail.fm - the way e-mail *should* be >=20 |