DOMFocusOut problem on xforms:input

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

DOMFocusOut problem on xforms:input

James Gu
I add an DOMFocusOut event on xforms:input. It seems it is triggered only when I click on another xforms component. If I just click on the blank area on page, this event won't be triggered, but actually the focus is not on the input field. I am not sure if this is a bug. Could you please check it?

                                <xforms:input ref="." >
                                    <xforms:action ev:event="DOMFocusOut">
                                        <xforms:message>Test</xforms:message
                                    </xforms:action>
                                </xforms:input>
Reply | Threaded
Open this post in threaded view
|

Re: DOMFocusOut problem on xforms:input

Erik Bruchez
Administrator
It seems to be what we are doing. I agree that it would be better if  
we sent DOMFocusOut as you propose. The best I can do now is enter a  
bug, but we can't promise we will fix it soon:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=311417&group_id=168&atid=350207

Do you have a workaround?

-Erik

On Oct 7, 2008, at 8:29 PM, JamesGu wrote:

>
> I add an DOMFocusOut event on xforms:input. It seems it is triggered  
> only
> when I click on another xforms component. If I just click on the  
> blank area
> on page, this event won't be triggered, but actually the focus is  
> not on the
> input field. I am not sure if this is a bug. Could you please check  
> it?
>
>                                <xforms:input ref="." >
>                                    <xforms:action  
> ev:event="DOMFocusOut">
>                                        <xforms:message>Test</
> xforms:message
>                                    </xforms:action>
>                                </xforms:input>
> --
> View this message in context: http://www.nabble.com/DOMFocusOut-problem-on-xforms%3Ainput-tp19871715p19871715.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: DOMFocusOut problem on xforms:input

James Gu
I don't have good solution now. Thank you for your information!
Reply | Threaded
Open this post in threaded view
|

Re: DOMFocusOut problem on xforms:input

Alessandro Vernet
Administrator
In reply to this post by James Gu
On Oct 7, 2008, at 8:29 PM, JamesGu wrote:

> I add an DOMFocusOut event on xforms:input. It seems it is triggered  
> only
> when I click on another xforms component. If I just click on the  
> blank area
> on page, this event won't be triggered, but actually the focus is  
> not on the
> input field. I am not sure if this is a bug. Could you please check  
> it?
>
>                                <xforms:input ref="." >
>                                    <xforms:action  
> ev:event="DOMFocusOut">
>                                        <xforms:message>Test</
> xforms:message
>                                    </xforms:action>
>                                </xforms:input>
If I remember correctly, the rational for not sending a DOMFocusOut  
event right away when a control looses the focus, but only when  
another control gets the focus goes as follows:

On IE, a control will loose the focus if you alt-tab to another  
application. In JavaScript, we receive a blur event. Then when you alt-
tab back to IE, the control gets a focus event. If we also dispatch  
those events at the XForms level, we would have more events generated  
(which can inpact performance), and a behavior which is not consistent  
depending on the browser you use (you would get more DOMFocusOut/
DOMFocusIn on IE than on Firefox). Since we don't know if we get a  
blur because the user clicked on the background or alt-tabbed to  
another application, we just don't dispatch a DOMFocusOut on blur. We  
wait for the next focus, and if that focus is on a different control,  
then we dispatch the DOMFocusOut/DOMFocusIn.

There might be a better way to do this, but I am not sure exactly what  
it would be, and, as Erik said, how soon we would be able to implement  
it. Could you tell us more about the practical problem you are trying  
to solve, and maybe we can help with that.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: DOMFocusOut problem on xforms:input

James Gu
Alex,

This is the example. I want to format our standard phone number in xml, so user can input the format we prepared for them.

           <xforms:instance id="test">
                <root>
                    <PhoneNumber>+1-999-9999999</PhoneNumber>
                    <Address></Address>
                </root>
            </xforms:instance>
The statndard format is +1-999-9999999, user want to see (999)999-9999. I put both an output and input on page. The output is used to display the formatted phone number. I use css to make it looks like a input field. When user clicks on the output, I formatted the phone number in xml and switch to the input field, so user will see the formatted phone number in input field. After he changes the phone number, I will change the phone number in xml back to the standard format. That's why I want to use DOMFocus out event.

 <xforms:switch ref="xxforms:instance('test')/PhoneNumber">
                        <xforms:case id="PhoneNumberDisplayd16e903" selected="true">
                            <xforms:trigger appearance="minimal">
                                <xforms:label>
                                    <xhtml:span class="my-input-style">
                                        <xforms:output value="format-phone(.)"/>  ----- display formatted phone number
                                    </xhtml:span>
                                </xforms:label>
                                <xforms:action ev:event="DOMActivate" ev:propagate="stop">
                                    <xforms:setvalue ref="." value="format-phone(.)"/>   ----- format phone in xml
                                    <xforms:toggle case="PhoneNumberValued16e903"/>
                                    <xforms:setfocus control="phoneNumberInputd16e903"/>
                                </xforms:action>
                            </xforms:trigger>
                        </xforms:case>
                        <xforms:case id="PhoneNumberValued16e903">
                            <xforms:input id="phoneNumberInputd16e903" ref="." incremental="true">
                                <xforms:action ev:event="DOMFocusOut">
                                    <xforms:toggle case="PhoneNumberDisplayd16e903"/>
                                                                    </xforms:action>
                                    <xforms:setvalue ref="."   value="change-back(.)"/>    ---- change the phone in xml back to standard
                                </xforms:action>
                            </xforms:input>
                        </xforms:case>
                    </xforms:switch>

Please let me know if you have suggestions.

Thanks,
James





Reply | Threaded
Open this post in threaded view
|

Re: Re: DOMFocusOut problem on xforms:input

Alessandro Vernet
Administrator
James,

On Oct 19, 2008, at 8:16 PM, JamesGu wrote:

> The statndard format is +1-999-9999999, user want to see  
> (999)999-9999. I
> put both an output and input on page. The output is used to display  
> the
> formatted phone number. I use css to make it looks like a input  
> field. When
> user clicks on the output, I formatted the phone number in xml and  
> switch to
> the input field, so user will see the formatted phone number in  
> input field.
Clever :). Now I see what you are doing. Unfortunately, there isn't a  
very reliable way to detect the focus out. We could improve this and  
dispatch a focus out when you click on the page background. But this  
won't always work: if you click on the label for the input (if you  
have one), for the browser it is as if you had clicked on the input,  
so we can't know that you clicked outside of the input.

For now, what I would do is to add a small "OK" button (or button with  
green V, or similar) next to the input field, and react to a  
DOMActivate on that button. Users can either click on it, or tab to it  
from the input field and press enter. Do you think that this could do  
the trick in your case?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: DOMFocusOut problem on xforms:input

James Gu
Alex,

Thank you for your suggestion. I think that's a good solution for now.

James