Forum OpenACS Development: tclwebtest help required

i am facing a problem with the selection of the radio button

i am using

tclwebtest::field select "Yes"

This is the error

This field has no choice Yes. It's only offerings are: {Y { } orgn_contact_search:elements:alumni:Y} {N { } orgn_contact                                    n_contact_search:elements:alumni:D}

the form page here is built by the ad_form,
this error occurs because the ad_form templating generates the radio button like
<tr><td> <input type="radio" name="alumni" value="Y" id="orgn_contact_search:elements:alumni:Y" checked /> </td>
                    <td><label for="orgn_contact_search:elements:alumni:Y">Yes</label></td></tr>

i need a help please did any body used for the test cases for the radio button with the ad_form templating system

thanks a lot
vamshi

Collapse
Posted by tammy m on
Well I haven't done this myself but I notice a field_select proc in tclwebtest docs. It's also used in the new tclwebtest automated install that will release with a later version of OACS. It looks like it lets you set a checkbox via its index (position) in the form. You could look at the example use in OACS code if you get the cvs HEAD of OACS and look in etc/install. Course it's supposed to be a private proc, so likely not the "right way" to do it;)
Collapse
Posted by Kolja Lehmann on
field_select is the pros internally used by the
"field select"
call, but the problem with radio button is, that the program has to guess, what the name of each option is. With a select box it is clear, because it is included in the option-tag. If the radio buttons and their captions are located in separate table cells (as it is in the default standard.adp form template), the caption is empty, so there is no way of determining the right option to choose. As you can see, in that list of choices given above, the second element (the caption) is always { }.
Does anyone know if it possible to select a radio button by its id? Or maybe it would be a good idea to extend the search for the caption on the whole tr the radio button is in.
Collapse
Posted by Tilmann Singer on
tclwebtest tries to recognize text that is contained in a td before the option tag and stuff it in the caption, but apparently it doesn't work in this case.

Peter Marklund committed a fix recently so that you can select the radio button by value now - try that.