[wtr-general] Re: Multiple lines in textarea

2009-06-08 Thread sfistak

Yeap thats OK!!

So I have a solution:

just add some additional char on end of each value in array (like ; )
then

an = answers.to_s.gsub(";","\n")

 ie.textfield(:name, "multiChoiceAnswers").set an

Thx for your help :)

On Jun 8, 2:00 pm, Željko Filipin 
wrote:
> And what happens if you do this?
>
> ie.textfield(:name, "multiChoiceAnswers").set "Answer1\nAnswer2\nAnswer3"
>
> Željko
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Multiple lines in textarea

2009-06-08 Thread sfistak

This enters each value and deletes previous one.

So I whats left in textfield is only "Answer3".

Thx
GS



On Jun 8, 1:49 pm, Željko Filipin 
wrote:
> Try this:
>
> answers.each do |item|
>     ie.textfield(:name, "multiChoiceAnswers").set item
> end
>
> Željko
> --http://watirpodcast.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Multiple lines in textarea

2009-06-08 Thread sfistak

Thx for help but still same problem.

I have fixed your advices:

irb(main):112:0> answers = ["answer1", "answer2", "answer3"]
=> ["answer1", "answer2", "answer3"]
irb(main):113:0> ie.text_field(:name, "multiChoiceAnswers").set
(answers.each do
|item| item + "\n" end)
ArgumentError: comparison of String with 128 failed
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:381:in `>'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:381:in `characters_in'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:368:in `type_by_character'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
input_elements
.rb:334:in `set'
from (irb):113
from :0

Any other ideas?

On Jun 8, 1:14 pm, jason  wrote:
> Oh and your text array should look as follows:
>
> answers = ["answer1","answer2","answer3"]
>
> On 8 Jun., 13:13, jason  wrote:
>
> > Your code is wrong - line is using puts ???
>
> > ie.textfield(:name, "multiChoiceAnswers").set(answers.each do |item|
> > puts item end)
>
> > change to
>
> > ie.textfield(:name, "multiChoiceAnswers").set(answers.each do |item|
> > item + "\n" )
>
> > Best R
> > Jason
>
> > On 8 Jun., 12:46, "grzegorz.smaj...@gmail.com"
>
> >  wrote:
> > > Hi,
>
> > > I face a problem with putting answers in textarea in new lines
>
> > > ex:
>
> > > I have a textarea:
>
> > >   > > align="left"  >
>
> > > I would like to put into that textarea answers in each line:
>
> > > [Answer1]
> > > [Answer2]
> > > [Answer3]
>
> > > When I create an array with answers:
> > > answers = []
> > > answers = "[answer1],[answer2],[answer3]"
>
> > > then:
> > > ie.textfield(:name, "multiChoiceAnswers").set(answers.each do |item|
> > > puts item end)
>
> > > I get the fallowing error:
>
> > > ArgumentError: comparison of String with 128 failed
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > input_elements
> > > .rb:381:in `>'
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > input_elements
> > > .rb:381:in `characters_in'
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > input_elements
> > > .rb:368:in `type_by_character'
> > >         from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
> > > input_elements
> > > .rb:334:in `set'
>
> > > Can any one advise?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---