Menu

#237 Troubles with TextArea element

Latest SVN
closed
None
5
2012-10-21
2005-03-02
obvious
No

I have following html page:
<html>
<head>

</head>
<body>
<form name="item" method="post">
<textarea name="question"></textarea>
<input type="submit" class="ButtonOK" name="btn_submit" value="Next" onClick="alert (get_index(this));">
</form>

<script language="JavaScript"> </script>

</body>
</html>

I enter some text to textarea and click button "Next":
WebClient client = new WebClient();
HtmlPage page = (HtmlPage)
client.getPage(new URL("file://c:\test.html"));
HtmlForm form =
page.getFormByName("item");
((HtmlTextArea)
form.getTextAreasByName("question").get(0)).setText
("some text");
form.getInputByName
("btn_submit").click();
I get followinf message:
WARNING: window.alert("false") no alert handler
installed.
But if I don't enter text to textarea and click "Next":
WebClient client = new WebClient();
HtmlPage page = (HtmlPage)
client.getPage(new URL("file://c:\test.html"));
HtmlForm form =
page.getFormByName("item");
form.getInputByName
("btn_submit").click();
I'll get another message:
WARNING: window.alert("1") no alert handler installed
And this is correct message, I think.
What is wrong? Why filling text influenses on my button?

Discussion

  • obvious

    obvious - 2005-03-02
     
  • obvious

    obvious - 2005-03-02

    test html page

     
  • Marc Guillemot

    Marc Guillemot - 2005-03-02

    Logged In: YES
    user_id=402164

    it would help if you say where it doesn't run correctly and
    what is the result that a real browser delivers.

     
  • obvious

    obvious - 2005-03-02

    Logged In: YES
    user_id=1180044

    Real browser(I checked for Internet Explorer 6.0 and Mozilla
    1.7.3) delivers: window.alert("1") . I think that it's correct.

     
  • Marc Guillemot

    Marc Guillemot - 2005-03-02

    Logged In: YES
    user_id=402164

    in both cases? In your description, you present 2 cases and
    I fail to understand what is wrong.

     
  • obvious

    obvious - 2005-03-02

    Logged In: YES
    user_id=1180044

    Browsers perform window.alert("1") whether I enter text to
    text area or no. But htmlunit gives two different results:
    window.alert("1") if I enter some text to text area,
    window.alert("false") if I don't enter text to textarea.

     
  • Marc Guillemot

    Marc Guillemot - 2005-03-02

    Logged In: YES
    user_id=402164

    Ok, now I understand.

    I've now got a minimal test illustrating the problem (it
    throws a ScriptException in htmlunit), but not found the
    cause of the problem yet:

    <html>
    <head>

    </head>
    <body>
    <form name="form1">
    <textarea name="question"></textarea>
    <input type="button" name="btn_submit" value="Next">
    </form>

    <script language="JavaScript"> document.form1.question.value = "some text"; alert("0: " + document.form1.elements[0].tagName); alert("1: " + document.form1.elements[1].tagName); </script>

    </body>
    </html>

     
  • Marc Guillemot

    Marc Guillemot - 2005-03-03

    Logged In: YES
    user_id=402164

    Should now be fixed in cvs.

    The problem was in the textarea DOM node: changing the text
    corrupted the dom tree (btw I've fixed the same problem
    concerning document's title).

     

Log in to post a comment.