http://www.perlmonks.org?node_id=999930

Matt™ has asked for the wisdom of the Perl Monks concerning the following question:

Seeking your wisdom Monks,

I have to click a radio button(code is provided below). The problem is that the Radio buttons are having same "Value" :( and bcoz of that i am unable to do it in the conventional way. but the buttons are having a different "id". So my humble question is that how can make it to click. (I have an alternate way to go by getting the URL directly, but i need to do it in the $mech->field or set_visible way, as i have permission to do it in that way only.. Is there any chance for that..?

Thanks in advance Monks !

<label for="date">Date <input type="radio" class="radio" id="date" name="sort" value="Y" oncl +ick="change_search_format('/cgi-bin/advsearch?reord=D&amp;lr=&amp;rep +eat_search=Y&amp;agency_group_id=&amp;vac_group_id=&amp;agency_id=&am +p;vr=&amp;agency_group_id=&amp;agency_id=&amp;vr=');"></label> <label for="salary">Salary <input type="radio" class="radio" id="salary" name="sort" value="Y" on +click="change_search_format('/cgi-bin/advsearch?reord=S&amp;lr=&amp;r +epeat_search=Y&amp;agency_group_id=&amp;vac_group_id=&amp;agency_id=& +amp;vr=');"></label> <label for="relevance">Relevance <input type="radio" class="radio" id="relevance" name="sort" value="Y" + checked="checked" onclick="change_search_format('/cgi-bin/advsearch? +reord=R&amp;lr=&amp;repeat_search=Y&amp;agency_group_id=&amp;vac_grou +p_id=&amp;agency_id=&amp;vr=');"></label>
  • Comment on Click on Radio Button by www::Mechanize [All buttons have same "value" but different "id" and "Onclick" Value.]
  • Download Code

Replies are listed 'Best First'.
Re: Click on Radio Button by www::Mechanize [All buttons have same "value" but different "id" and "Onclick" Value.]
by Corion (Patriarch) on Oct 19, 2012 at 14:27 UTC