--001485f7c16e047d630487084d5c
Content-Type: text/plain; charset=ISO-8859-1
On Thu, May 20, 2010 at 8:05 AM, KingMaker KingMaker
<sweetzubair / gmail.com>wrote:
> Hi Friends,
>
> I try to check the Multiple Checkboxes in the page.
> first i read the value in the text file and assing it to the variable.
> but the problem is that at the time only one check box are selected.
>
> textfile values:
> selectedLocationOids 00025354000000630d
> selectedLocationOids 0002527100000062bc
>
> ______________________________________________________________________________
> HTML Code:
>
> <input type
heckbox" value 000025354000000630d"
> name electedLocationOids" id electedLocationOids"
> class mCheckbox">
>
> <input type
heckbox" value 00002527100000062bc"
> name electedLocationOids" id electedLocationOids"
> class mCheckbox">
>
> ______________________________________________________________________________
>
> RUBY Script:
> require 'watir'
> include Watir
> require 'logger'
>
> opts }
> File.open("c:/test/Flow1.txt") do |f|
> f.each_line do |line|
> opts[$1] 2 if line /^(.*) *)$/
> end
> end
> @check_location pts["selectedLocationOids"]
> @check_location1 pts["selectedLocationOids"]
>
>
> ie.checkbox(:value,@check_location).set()
> ie.checkbox(:value,@check_location1).set()
> --
> Posted via http://www.ruby-forum.com/.
>
>
In addition to what Marcin said:
*Your html can't have two elements with the same ID (ID's must be unique,
like a social security number)
*Your inputs should end with /> instead of just > to close the tag.
*Since they are checkboxes, they should also have different names. The name
is what determines the name of the key that the server receives, so when you
have two inputs whose names are selectedLocationOids, then clicking both
causes one to be overwritten.
To illustrate, when I submit your form, my server receives:
Submitting with neither box checked
Parameters: {"commit"