Error Setting text input

14 views
Skip to first unread message

TangoNetworks

unread,
Dec 13, 2010, 10:54:11 AM12/13/10
to watij
Here's the html for the input:

<input type="text" value="" size="25" maxlength="45" name="lastName">

After the exception I've listed all the string we're setting. They all
work with the exception of "Pe=Test" and "Pe'Test"

When I try to set these values I see this exception. Again, all the
other strings work fine... its just the two that's giving me fits. Any
suggestions? I've tried escaping the = and ' but "Pe\=Tes" and "Pe
\'Test" still fails.

thanks
-Chris

- An error has occurs during execution JavaScript code with the
following contet: elementForWatix =
watix61[0];elementForWatix.Pe=Test;
com.jniwrapper.win32.com.ComException: COM object method returns error
code: 0x0020101; Description: Could not complete the operation due to
error 80020101.
at
com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMeth
d(SourceFile:743)
at
com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMeth
d(SourceFile:722)
at
com.jniwrapper.win32.mshtml.impl.IHTMLWindow2Impl.execScript(Unknown
Source)
at com.jniwrapper.win32.ie.gj.execute(Unknown Source)
at com.jniwrapper.win32.ie.cv.run(Unknown Source)
at com.jniwrapper.win32.MessageLoopThread
$ThreadSynchronizedAction.run(
essageLoopThread.java:566)
at com.jniwrapper.win32.MessageLoopThread
$LoopThread.run(MessageLoopThr
ad.java:508)

"Pe##Test",
"Pe\+Test",
"Pe/Test",
"Pe**Test",
"1PeTest", "2222",
"Pe=Test",
"Pe)Test",
"Pe(Test",
"Pe$Test",
"Pe^Test",
"Pe@Test",
"Pe!Test",
"Pe~Test",
"Pe`Test",
"Pe'Test",
'Pe\"Test',
"Pe:Test",
"Pe;Test",
"Pe?Test",
"Pe>Test",
"Pe<Test",
"Pe|Test",
"Pe\Test"

TangoNetworks

unread,
Dec 13, 2010, 11:01:55 AM12/13/10
to watij
solved my own problem....

this fails:

input.set(value)

this doesn't:

input.set("value", value)

thanks
-C

Brian Knorr

unread,
Dec 13, 2010, 1:50:15 PM12/13/10
to watij
input.set(value) is working as intended...if you don't include a '='
in the set it will instead set the tag's content. Here are some
examples:

//set value property of an input
input.set("value='My Last Name'");

//set the innerText property of a textarea
textarea.set("Some Description");

Please take a look at the documentation http://watij.com/webspec-api
under the section "HTML Tags and Javascript"...it's important to
understand how these methods work.

Best,

Brian

TangoNetworks

unread,
Dec 13, 2010, 1:54:25 PM12/13/10
to watij
yep, still learning.

The first exception was cause by the single quote in the string. I
added some code in webSpec to add the escape char "\" to the string
and got past that:

public Tag property(String property, String value) {
value = value.replace("'", "\\\'");
return tag.set(property + "='" + value + "'");
}

thanks

On Dec 13, 12:50 pm, Brian Knorr <btkn...@gmail.com> wrote:
> input.set(value) is working as intended...if you don't include a '='
> in the set it will instead set the tag's content. Here are some
> examples:
>
> //set value property of an input
> input.set("value='My Last Name'");
>
> //set the innerText property of a textarea
> textarea.set("Some Description");
>
> Please take a look at the documentationhttp://watij.com/webspec-api
Reply all
Reply to author
Forward
0 new messages