I've a form to fill in a subsection of which looks sort of like this:
<label for="emp-type-0" class="checkbox-label checkbox-all">
<input class="checkbox" id="emp-type-0" type="checkbox" name="JobStatus"
value="0" onClick="FirstCheckBox('JobSearch', 'JobStatus')"
checked="checked" > All</label>
<label for="emp-type-1" class="checkbox-label"><input class="checkbox"
id="emp-type-1" type="checkbox" name="JobStatus" value="1"
onClick="OtherCheckBox('JobSearch', 'JobStatus')"> Full Time</label>
<label for="emp-type-2" class="checkbox-label"><input class="checkbox"
id="emp-type-2" type="checkbox" name="JobStatus" value="2"
onClick="OtherCheckBox('JobSearch', 'JobStatus')"> Part Time</label>
<label for="emp-type-3" class="checkbox-label"><input class="checkbox"
id="emp-type-3" type="checkbox" name="JobStatus" value="3"
onClick="OtherCheckBox('JobSearch', 'JobStatus')"> Contract</label>
<label for="emp-type-4" class="checkbox-label"><input class="checkbox"
id="emp-type-4" type="checkbox" name="JobStatus" value="4"
onClick="OtherCheckBox('JobSearch', 'JobStatus')"> Temp to Hire</label>
Single name, multiple check boxes and I want to uncheck 1 and check 2, 4 & 5.
This works but is clunky compared to mech->set_fields():
my $form = $mech->form_name('JobSearch');
$form->find_input( 'JobStatus', 'checkbox' )->value('off');
$form->find_input( 'JobStatus', 'checkbox', '2' )->value(1);
$form->find_input( 'JobStatus', 'checkbox', '4' )->value(3);
$form->find_input( 'JobStatus', 'checkbox', '5' )->value(4);
These don't set all check boxes properly:
$response = $mech->set_fields(
'JobStatus' => [ 'off', 1, '1', 2, '3', 4, '4', 5 ]
);
$response = $mech->set_fields(
'JobStatus' => { [ 'off', 1 ],
[ '1', 2 ],
[ '3', 4 ],
[ '4', 5 ], }
);
# I think it was this one gave an error
$response = $mech->set_fields(
'JobStatus' => ( [ 'off', 1 ],
[ '1', 2 ],
[ '3', 4 ],
[ '4', 5 ], )
);
$response = $mech->set_fields(
'JobStatus' => 'off',
'JobStatus' => [ '1', 2 ],
'JobStatus' => [ '3', 4 ],
'JobStatus' => [ '4', 5 ],
);
Could someone tell me what the proper syntax is please?
Or if mech->set_visible could be used here?
Thanks,
Mike McClain
--
Satisfied user of Linux since 1997.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org