Itsnat problem on Chrome

25 views
Skip to first unread message

Licky

unread,
Jul 18, 2013, 12:31:26 AM7/18/13
to its...@googlegroups.com
It was found that if the HTML input text element was created in server side (i.e. using the function HTMLDocument createElement("input") and inputField.setAttribute("type", "text") ), then create component by this element. If change value in Chrome first time, Chrome will not sent out the new value to server.

Jose Maria Arranz Santamaria

unread,
Jul 18, 2013, 4:36:16 PM7/18/13
to its...@googlegroups.com, use.by...@gmail.com
I cannot reproduce your problem.

I've tried this code:

        HTMLDocument doc = (HTMLDocument)itsNatDoc.getDocument();
        Element inputElem = doc.createElement("input");
        inputElem.setAttribute("type","text");      
        doc.getBody().appendChild(inputElem);
        final ItsNatHTMLInputText comp = (ItsNatHTMLInputText)itsNatDoc.getItsNatComponentManager().createItsNatComponent(inputElem);
        comp.setText("Initial Value");
        comp.getDocument().addDocumentListener(new DocumentListener()
        {
            public void insertUpdate(DocumentEvent e)
            {
                String text = comp.getText();
                System.out.println("insertUpdate " + text);
            }

            public void removeUpdate(DocumentEvent e)
            {
                String text = comp.getText();
                System.out.println("removeUpdate " + text);
            }

            public void changedUpdate(DocumentEvent e)
            {
                String text = comp.getText();
                System.out.println("changedUpdate " + text);
            }              
        });

And executed in an EventListener request and it works fine in Chrome (changes in control are sent to the server).

Is different your case?

Can you paste the code snippet?

Be careful with your custom JS code, it can break the ItsNat "client-server contract".

Licky

unread,
Jul 18, 2013, 11:00:28 PM7/18/13
to its...@googlegroups.com

Thanks. Your code snippet works on my case. Anyway, I will also provide my snippet later.

Licky

unread,
Jul 20, 2013, 1:27:01 PM7/20/13
to its...@googlegroups.com

When I was going to write my code to post here, I found the issue is also occur in the feature showcase example. You can go to Components->Text->Text Fields->Input Text Based to reproduce the problem.

The first line of input text was highlighted by default. Simply press the [delete] button on keyboard to remove the text and press the mouse cursor anywhere. In Firefox or IE, a message dialogue shows the message that characters are removed. However, in Chrome, no message shown.

On Friday, July 19, 2013 4:36:16 AM UTC+8, Jose Maria Arranz Santamaria wrote:

Jose Maria Arranz Santamaria

unread,
Jul 20, 2013, 2:35:20 PM7/20/13
to its...@googlegroups.com, use.by...@gmail.com
Arrg, is a Chrome bug, change event is not fired in this case 

Try to add this: onchange="document.body.style.background='red'" , is not executed.

I've found this problem in old crappy (usually mobile) browsers but hard to believe in a modern Chrome.

I'll try to add a workaround, maybe also listening the blur event, as said before this is not new for me, I've used to deal with really bad browsers :)

Jose Maria Arranz Santamaria

unread,
Jul 21, 2013, 4:52:29 AM7/21/13
to its...@googlegroups.com, use.by...@gmail.com
It seems only a problem of Chrome (desktop or Android), not WebKit, tried Safari and works fine, even the old crappy WebKit of Android pre-Chrome works ok.


El sábado, 20 de julio de 2013 19:27:01 UTC+2, Licky escribió:

Jose Maria Arranz Santamaria

unread,
Jul 24, 2013, 4:10:53 PM7/24/13
to its...@googlegroups.com, use.by...@gmail.com
It is a very SERIOUS bug of Chrome, it (almost) happens when:

1) Input text (and password) is dynamically inserted with some initial value
2) You FULLY clear the initial value (and lose the focus), if you remove just some letters the change event is fired.

Maybe it has to do with this bug:


I can imagine millions of web sites/apps broken... but not ItsNat based :)

Fortunately I've developed a workaround for input components (blur is managed like a change event in Chrome), if you're in a hurry, download a snapshot of ItsNat.jar of the upcoming 1.3.2 (or upper) version here:

Reply all
Reply to author
Forward
0 new messages