interaction between javascript and xforms

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

interaction between javascript and xforms

julien-29
Hello,
 
I would like to the result of a javascript method is use for determine if a xforms control is valid or not.
My javascript method test the format of my input, and if the format is not good, I would like to make this input invalid.
I'm required to use a javascript method, because the format of my input is very special.
 
I try to dispatch event with the javascript API but it happens nothing:
 
<xforms:input ref="/form/FormCommunOrbeon/DemandeTiers/mvAdresses/CTierAdresseVO[moNature/miCode = '3']/msTel" id="Telephone" >
    <xforms:action ev:event="xforms-value-changed">
        <xxforms:script>
             if( !checkFormat(this) ) {
                  ORBEON.xforms.Document.dispatchEvent("Telephone", "focus");
              } 
         </xxforms:script>
    </xforms:action>
    
    <xforms:action ev:event="DOMFocusIn">
        <xxforms:script>
          alert('focus');
        </xxforms:script>
    </xforms:action>
</xforms:input>
 
 
Have you an idea ?
 
thank you.


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



--
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: interaction between javascript and xforms

Erik Bruchez
Administrator
Did you allow this event on your model as document here:

http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript-events

-Erik

Bittard, Julien wrote:

> Hello,
>  
> I would like to the result of a javascript method is use for determine
> if a xforms control is valid or not.
> My javascript method test the format of my input, and if the format is
> not good, I would like to make this input invalid.
> I'm required to use a javascript method, because the format of my input
> is very special.
>  
> I try to dispatch event with the javascript API but it happens nothing:
>  
> <xforms:input
> ref="/form/FormCommunOrbeon/DemandeTiers/mvAdresses/CTierAdresseVO[moNature/miCode
> = '3']/msTel" id="Telephone" >
>     <xforms:action ev:event="xforms-value-changed">
>         <xxforms:script>
>              if( !checkFormat(this) ) {
>                   ORBEON.xforms.Document.dispatchEvent("Telephone",
> "focus");
>               }
>          </xxforms:script>
>     </xforms:action>
>    
>     <xforms:action ev:event="DOMFocusIn">
>         <xxforms:script>
>           alert('focus');
>         </xxforms:script>
>     </xforms:action>
> </xforms:input>
>  
>  
> Have you an idea ?
>  
> thank you.
>
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be
> copied, disclosed to, retained or used by, any other party. If you are
> not an intended recipient then please promptly delete this e-mail and
> any attachment and all copies and inform the sender. Thank you.
>

--
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: interaction between javascript and xforms

julien-29
Yes it is.
My purpose is to modify the value of instance in order to make a xform control
invalid.


--
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: interaction between javascript and xforms

Erik Bruchez
Administrator
Ok. So first, is the xxforms:script called? You should be able to see
this by putting a call to alert() in it.

-Erik

[hidden email] wrote:
> Yes it is.
> My purpose is to modify the value of instance in order to make a xform control
> invalid.
>


--
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: interaction between javascript and xforms

julien-29
Yes when I change the value of the input, the xforms-value-changed event is
fired (my javascript method execute an 'alert').


--
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: interaction between javascript and xforms

Alessandro Vernet
Administrator
Julien,

On 11/1/07, [hidden email]
<[hidden email]> wrote:
> Yes when I change the value of the input, the xforms-value-changed event is
> fired (my javascript method execute an 'alert').

In JavaScript you dispatch an event named "focus":

ORBEON.xforms.Document.dispatchEvent("Telephone", "focus");

But then you listen to an event named "DOMFocusIn":

<xforms:action ev:event="DOMFocusIn">

You would need to dispatch a DOMFocusIn, or listen on a focus. I
generally prefer to choose event names which make it clear that they
comes from JavaScript, but of course any name should do.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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: interaction between javascript and xforms

julien-29
Yes it's ok.
I tried this :
ORBEON.xforms.Document.dispatchEvent('AssoLoi1901','DOMFocusIn');
and the input 'AssoLoi1901' fired this event with "<xforms:action
ev:event="DOMFocusIn">".

I didn't see in the doc
(http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript) that we
can only use the events DOMActivate, DOMFocusIn and DOMFocusOut. Else we must
"add the xxforms:external-events attribute on the first <xforms:model>".

Now it's ok.


--
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: interaction between javascript and xforms

Alessandro Vernet
Administrator
On 11/2/07, [hidden email]
<[hidden email]> wrote:
> I didn't see in the doc
> (http://www.orbeon.com/ops/doc/reference-xforms-2#xforms-javascript) that we
> can only use the events DOMActivate, DOMFocusIn and DOMFocusOut. Else we must
> "add the xxforms:external-events attribute on the first <xforms:model>".

That's right.

> Now it's ok.

Excellent :).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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