Thread: RE: [tclwebtest] Checking a checkbox using the value
Status: Abandoned
Brought to you by:
tils
From: Michael H. <Mic...@qu...> - 2004-01-28 10:34:15
|
Thanks, Peter. I can get it to work using field find, field check, field find -next, etc. but because all the checkboxes have the same name, I'm relying on them being displayed in a particular order. Since I know you have expertise in the area I can go into a bit more detail ;) I'm automating a build of an OpenACS system, and the page in question is the one in the APM where you select which packages to install. I could write my own scripts to do this but I think it's cleaner to have the test harness completely external. Out of interest, how are you guys doing the rebuild of dotLRN every night? > -----Original Message----- > From: Peter Marklund [mailto:pe...@co...] > Sent: 27 January 2004 19:12 > To: Michael Hinds; tcl...@li... > Subject: Re: [tclwebtest] Checking a checkbox using the value > > > Hey Michael! > I'm not 100% sure you can use this for checkboxes, but I > think you can. > Here it is: > > field select2 ~v value > > Look at the file > > http://cvs.openacs.org/cvs/openacs-4/contrib/packages/simulati > on/test/simulation-test-procs.tcl?view=auto&rev=1.13 > > for examples of this. > > Peter > > On Tue, 27 Jan 2004 18:55:51 -0000, "Michael Hinds" > <Mic...@qu...> said: > > I'm trying to select a checkbox using its value. The HTML > is something > > like > > this: > > > > <input type=checkbox name=enable value="some-identifier-here"> > > <input type=checkbox name=enable value="something-else-here"> > > <input type=checkbox name=enable value="and-another"> > > > > I thought I could use: > > > > field check ~v general-comments > > > > but it throws the field not found exception. The following > works, but > > isn't > > very useful to me: > > > > field check ~n enable > > > > If anyone knows what I'm doing wrong off the top of their head, I'd > > appreciate the help. > > > > Thanks, > > > > Michael > > > > > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by EclipseCon 2004 > > Premiere Conference on Open Tools Development and Integration > > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > http://www.eclipsecon.org/osdn > > _______________________________________________ > > Tclwebtest-general mailing list > > Tcl...@li... > > https://lists.sourceforge.net/lists/listinfo/tclwebtest-general > Collaboraid > - Open Source Web Collaboration Software > http://www.collaboraid.biz > |
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 |
From: Peter M. <pe...@co...> - 2004-01-28 11:09:14
|
Hey Michael! For automatic build of OpenACS and .LRN you should use the install scripts that we have put quite a lot of work into. If you use them I'm sure we'd get some valuable feedback so that we can improve them further. Obtain the scripts like this: cvs -d :pserver:ano...@op...:/cvsroot checkout openacs-4/etc/install There is a document that says a little about how to use the scripts here: http://openacs.org/doc/openacs-HEAD/openacs.html Good luck! Peter On Wed, 28 Jan 2004 10:28:14 -0000, "Michael Hinds" <Mic...@qu...> said: > Thanks, Peter. I can get it to work using field find, field check, field > find -next, etc. but because all the checkboxes have the same name, I'm > relying on them being displayed in a particular order. > > Since I know you have expertise in the area I can go into a bit more > detail > ;) I'm automating a build of an OpenACS system, and the page in question > is > the one in the APM where you select which packages to install. I could > write > my own scripts to do this but I think it's cleaner to have the test > harness > completely external. > > Out of interest, how are you guys doing the rebuild of dotLRN every > night? > > > -----Original Message----- > > From: Peter Marklund [mailto:pe...@co...] > > Sent: 27 January 2004 19:12 > > To: Michael Hinds; tcl...@li... > > Subject: Re: [tclwebtest] Checking a checkbox using the value > > > > > > Hey Michael! > > I'm not 100% sure you can use this for checkboxes, but I > > think you can. > > Here it is: > > > > field select2 ~v value > > > > Look at the file > > > > http://cvs.openacs.org/cvs/openacs-4/contrib/packages/simulati > > on/test/simulation-test-procs.tcl?view=auto&rev=1.13 > > > > for examples of this. > > > > Peter > > > > On Tue, 27 Jan 2004 18:55:51 -0000, "Michael Hinds" > > <Mic...@qu...> said: > > > I'm trying to select a checkbox using its value. The HTML > > is something > > > like > > > this: > > > > > > <input type=checkbox name=enable value="some-identifier-here"> > > > <input type=checkbox name=enable value="something-else-here"> > > > <input type=checkbox name=enable value="and-another"> > > > > > > I thought I could use: > > > > > > field check ~v general-comments > > > > > > but it throws the field not found exception. The following > > works, but > > > isn't > > > very useful to me: > > > > > > field check ~n enable > > > > > > If anyone knows what I'm doing wrong off the top of their head, I'd > > > appreciate the help. > > > > > > Thanks, > > > > > > Michael > > > > > > > > > > > > > > > ------------------------------------------------------- > > > The SF.Net email is sponsored by EclipseCon 2004 > > > Premiere Conference on Open Tools Development and Integration > > > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > > > http://www.eclipsecon.org/osdn > > > _______________________________________________ > > > Tclwebtest-general mailing list > > > Tcl...@li... > > > https://lists.sourceforge.net/lists/listinfo/tclwebtest-general > > Collaboraid > > - Open Source Web Collaboration Software > > http://www.collaboraid.biz > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Tclwebtest-general mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tclwebtest-general Collaboraid - Open Source Web Collaboration Software http://www.collaboraid.biz |
From: Peter M. <pet...@fa...> - 2004-01-28 14:55:57
|
Hey Michael! I happened to come across the need to check some checkboxes 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: 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. @checkbox_name The name of the checkboxes to check @checkbox_values A list of values that indicate which checkboxes to check @autor Peter Marklund } { while { 1 } { if { [catch {field find -next ~n $checkbox_name ~t checkbox}] } { # No more checkboxes break } =20=20=20=20=20=20=20=20 array set current_field [::tclwebtest::field_current] set checkbox_value [lindex $current_field(choices) 1] if { [lsearch -exact $checkbox_values $checkbox_value] !=3D -1 } { field check } else { # field_find -next will give us the current field eternally as # long as it hasn't been modified so increment current field manually incr ::tclwebtest::current_field } } } Use it like this: field check_multiple my_checkbox_name [list value1 value2 value3] Peter =20 ---------------------------- Peter Marklund C/O Thomas Sch=F6nbeck Oster Farimagsgade 77 2100 Copenhagen Denmark Work Phone: +45-33436380 Mobile phone: +45-20820101 Home phone: +45-35559440 http://collaboraid.biz http://petermarklund.com ---------------------------- http://fastmail.fm - the way e-mail *should* be |