Good day everyone.
I have the following problem: developing an application using Orbeon Presentation Server (aka OPS), I need an additional action to be performed using simple javascript code. I know at this stage, that javascript chunks can be declared between <script> and </script> tags. But, as I tried, I can only call a function when page loads. The documentation regarding this problem is still unaccessible for me (perhaps it doesn't exist). I have found something regarding this: <xhtml:script> function javascriptfuction() { ... } </xhtml:script> <xforms:input ...> <xforms:action ev:event="xforms-value-changed"> ... <xforms:setvalue ref="instance('dummy')/dummy" value="inline:javascriptfuction()"> </xforms:action> </xforms:input> But it tells me that "inline" prefix is not defined. Can anyone help me? -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
You cannot call JavaScript this way from XForms. Two alternatives come to mind:
1) If your logic is simple enough, you could write it in XPath. We use XPath 2.0, so you can do pretty sophisticated just with XPath. 2) If the logic is more complex, you can trigger a submission replace="instance" and have the value calculated on the server-side by a "service". Alex On 3/22/06, [hidden email] <[hidden email]> wrote: > Good day everyone. > > I have the following problem: developing an application using Orbeon Presentation Server (aka OPS), I need an additional action to be performed using simple javascript code. I know at this stage, that javascript chunks can be declared between <script> and </script> tags. But, as I tried, I can only call a function when page loads. The documentation regarding this problem is still unaccessible for me (perhaps it doesn't exist). I have found something regarding this: > > <xhtml:script> > function javascriptfuction() > { > ... > } > </xhtml:script> > > <xforms:input ...> > <xforms:action ev:event="xforms-value-changed"> > ... > <xforms:setvalue ref="instance('dummy')/dummy" value="inline:javascriptfuction()"> > </xforms:action> > </xforms:input> > > But it tells me that "inline" prefix is not defined. > Can anyone help me? > > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alessandro Vernet wrote: You cannot call JavaScript this way from XForms. Two alternatives come to mind: 1) If your logic is simple enough, you could write it in XPath. We use XPath 2.0, so you can do pretty sophisticated just with XPath. 2) If the logic is more complex, you can trigger a submission replace="instance" and have the value calculated on the server-side by a "service". Alex On 3/22/06, [hidden email] [hidden email] wrote:Good day everyone. I have the following problem: developing an application using Orbeon Presentation Server (aka OPS), I need an additional action to be performed using simple javascript code. I know at this stage, that javascript chunks can be declared between <script> and </script> tags. But, as I tried, I can only call a function when page loads. The documentation regarding this problem is still unaccessible for me (perhaps it doesn't exist). I have found something regarding this: <xhtml:script> function javascriptfuction() { ... } </xhtml:script> <xforms:input ...> <xforms:action ev:event="xforms-value-changed"> ... <xforms:setvalue ref="instance('dummy')/dummy" value="inline:javascriptfuction()"> </xforms:action> </xforms:input> But it tells me that "inline" prefix is not defined. Can anyone help me? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws-- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
What I see that is not yet implemented in OPS is autocomplete. You may say: it is on the way, it is coming... But, currently, I can see only server-side working example, and when attempting copying sources over fresh update of OPS.tar.gz, it displays a combo box instead of fully-working autocomplete. Too sad :(. I am running it on tomcat 5.0.1 using jdk1.4.2.
I have a presentation this monday, which decides whether we will able to use XForms + OPS in our project, or keep the old HTML+JS scheme. Can not wait. A simple javascript call would do the right thing, and when official OPS autocomplete will be ready, the code just gathers it's transparency. Finally, I am wondering: if javascript is supported by OPS, why not letting it function within xforms events? Such examples as autocomplete will always raise up during project development. Regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Al.Haziz,
I am using the autocomplete in a page at the moment, although the sorting is done server-side it is fully implemented and shows perfectly Check out the Controls example on the Orbeon website and its pretty much copy and paste! You may need to get an unstable build though Ryan Puddephatt Software Engineer TFX Group - IT UK 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: [hidden email] [mailto:[hidden email]] >Sent: 24 March 2006 13:24 >To: [hidden email] >Subject: Re: Re: [ops-users] Using javascript in XForms pages > >What I see that is not yet implemented in OPS is autocomplete. You may say: >it is on the way, it is coming... But, currently, I can see only server- >side working example, and when attempting copying sources over fresh update >of OPS.tar.gz, it displays a combo box instead of fully-working >autocomplete. Too sad :(. I am running it on tomcat 5.0.1 using jdk1.4.2. > I have a presentation this monday, which decides whether we will able to >use XForms + OPS in our project, or keep the old HTML+JS scheme. Can not >wait. A simple javascript call would do the right thing, and when official >OPS autocomplete will be ready, the code just gathers it's transparency. > Finally, I am wondering: if javascript is supported by OPS, why not >letting it function within xforms events? Such examples as autocomplete >will always raise up during project development. > Regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Sir Ryan,
the server-side filtering and sorting is not a problem for the prototype I am working on. Can you tell me where can I get that unstable build? Regards, Al.Haziz. --- Ryan Puddephatt <[hidden email]> wrote: > Al.Haziz, > I am using the autocomplete in a page at the > moment, although the > sorting is done server-side it is fully implemented > and shows perfectly > > Check out the Controls example on the Orbeon website > and its pretty much > copy and paste! You may need to get an unstable > build though > > Ryan Puddephatt > Software Engineer > TFX Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotand > EH54 7DP > > * [hidden email] > ( 01506 407 110 > 7 01506 407 108 > > > >-----Original Message----- > >From: [hidden email] [mailto:[hidden email]] > >Sent: 24 March 2006 13:24 > >To: [hidden email] > >Subject: Re: Re: [ops-users] Using javascript in > XForms pages > > > >What I see that is not yet implemented in OPS is > autocomplete. You may say: > >it is on the way, it is coming... But, currently, I > can see only server- > >side working example, and when attempting copying > sources over fresh update > >of OPS.tar.gz, it displays a combo box instead of > fully-working > >autocomplete. Too sad :(. I am running it on tomcat > 5.0.1 using jdk1.4.2. > > I have a presentation this monday, which decides > whether we will able to > >use XForms + OPS in our project, or keep the old > HTML+JS scheme. Can not > >wait. A simple javascript call would do the right > thing, and when official > >OPS autocomplete will be ready, the code just > gathers it's transparency. > > Finally, I am wondering: if javascript is > supported by OPS, why not > >letting it function within xforms events? Such > examples as autocomplete > >will always raise up during project development. > > Regards, Al.Haziz. > > > > > > -- > 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 > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > Send instant messages to your online friends http://uk.messenger.yahoo.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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Al Haziz,
You can get an unstable nightly build from here (http://forge.objectweb.org/nightlybuilds/ops/ops/) Ryan Puddephatt Software Engineer TFX Group - IT UK 1 Michaelson Square Livingston West Lothian Scotand EH54 7DP * [hidden email] ( 01506 407 110 7 01506 407 108 >-----Original Message----- >From: al haziz [mailto:[hidden email]] >Sent: 24 March 2006 14:53 >To: [hidden email] >Subject: RE: Re: [ops-users] Using javascript in XForms pages > >Sir Ryan, > the server-side filtering and sorting is not a >problem for the prototype I am working on. Can you >tell me where can I get that unstable build? > > Regards, Al.Haziz. > >--- Ryan Puddephatt <[hidden email]> wrote: > >> Al.Haziz, >> I am using the autocomplete in a page at the >> moment, although the >> sorting is done server-side it is fully implemented >> and shows perfectly >> >> Check out the Controls example on the Orbeon website >> and its pretty much >> copy and paste! You may need to get an unstable >> build though >> >> Ryan Puddephatt >> Software Engineer >> TFX Group - IT UK >> 1 Michaelson Square >> Livingston >> West Lothian >> Scotand >> EH54 7DP >> >> * [hidden email] >> ( 01506 407 110 >> 7 01506 407 108 >> >> >> >-----Original Message----- >> >From: [hidden email] [mailto:[hidden email]] >> >Sent: 24 March 2006 13:24 >> >To: [hidden email] >> >Subject: Re: Re: [ops-users] Using javascript in >> XForms pages >> > >> >What I see that is not yet implemented in OPS is >> autocomplete. You may say: >> >it is on the way, it is coming... But, currently, I >> can see only server- >> >side working example, and when attempting copying >> sources over fresh update >> >of OPS.tar.gz, it displays a combo box instead of >> fully-working >> >autocomplete. Too sad :(. I am running it on tomcat >> 5.0.1 using jdk1.4.2. >> > I have a presentation this monday, which decides >> whether we will able to >> >use XForms + OPS in our project, or keep the old >> HTML+JS scheme. Can not >> >wait. A simple javascript call would do the right >> thing, and when official >> >OPS autocomplete will be ready, the code just >> gathers it's transparency. >> > Finally, I am wondering: if javascript is >> supported by OPS, why not >> >letting it function within xforms events? Such >> examples as autocomplete >> >will always raise up during project development. >> > Regards, Al.Haziz. >> >> >> >> > >> -- >> 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 >> ObjectWeb mailing lists service home page: >> http://www.objectweb.org/wws >> > > >Send instant messages to your online friends http://uk.messenger.yahoo.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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Thanks a lot!
--- Ryan Puddephatt <[hidden email]> wrote: > Al Haziz, > You can get an unstable nightly build from here > (http://forge.objectweb.org/nightlybuilds/ops/ops/) > > Ryan Puddephatt > Software Engineer > TFX Group - IT UK > 1 Michaelson Square > Livingston > West Lothian > Scotand > EH54 7DP > > * [hidden email] > ( 01506 407 110 > 7 01506 407 108 > > > >-----Original Message----- > >From: al haziz [mailto:[hidden email]] > >Sent: 24 March 2006 14:53 > >To: [hidden email] > >Subject: RE: Re: [ops-users] Using javascript in > XForms pages > > > >Sir Ryan, > > the server-side filtering and sorting is not a > >problem for the prototype I am working on. Can you > >tell me where can I get that unstable build? > > > > Regards, Al.Haziz. > > > >--- Ryan Puddephatt <[hidden email]> > wrote: > > > >> Al.Haziz, > >> I am using the autocomplete in a page at the > >> moment, although the > >> sorting is done server-side it is fully > implemented > >> and shows perfectly > >> > >> Check out the Controls example on the Orbeon > website > >> and its pretty much > >> copy and paste! You may need to get an unstable > >> build though > >> > >> Ryan Puddephatt > >> Software Engineer > >> TFX Group - IT UK > >> 1 Michaelson Square > >> Livingston > >> West Lothian > >> Scotand > >> EH54 7DP > >> > >> * [hidden email] > >> ( 01506 407 110 > >> 7 01506 407 108 > >> > >> > >> >-----Original Message----- > >> >From: [hidden email] > [mailto:[hidden email]] > >> >Sent: 24 March 2006 13:24 > >> >To: [hidden email] > >> >Subject: Re: Re: [ops-users] Using javascript in > >> XForms pages > >> > > >> >What I see that is not yet implemented in OPS is > >> autocomplete. You may say: > >> >it is on the way, it is coming... But, > currently, I > >> can see only server- > >> >side working example, and when attempting > copying > >> sources over fresh update > >> >of OPS.tar.gz, it displays a combo box instead > of > >> fully-working > >> >autocomplete. Too sad :(. I am running it on > tomcat > >> 5.0.1 using jdk1.4.2. > >> > I have a presentation this monday, which > decides > >> whether we will able to > >> >use XForms + OPS in our project, or keep the old > >> HTML+JS scheme. Can not > >> >wait. A simple javascript call would do the > right > >> thing, and when official > >> >OPS autocomplete will be ready, the code just > >> gathers it's transparency. > >> > Finally, I am wondering: if javascript is > >> supported by OPS, why not > >> >letting it function within xforms events? Such > >> examples as autocomplete > >> >will always raise up during project development. > >> > Regards, Al.Haziz. > >> > >> > >> > >> > > >> -- > >> 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 > >> ObjectWeb mailing lists service home page: > >> http://www.objectweb.org/wws > >> > > > > > >Send instant messages to your online friends > http://uk.messenger.yahoo.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 > ObjectWeb mailing lists service home page: > http://www.objectweb.org/wws > Send instant messages to your online friends http://uk.messenger.yahoo.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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Adrian Baker-2
Adrian,
In XForms, in a number of places you can use XPath expressions. In those XPath expressions you can use any of the function defined in the "XQuery 1.0 and XPath 2.0 Functions and Operators" specification [1]. When those functions are not enough, you can either: 1) Call an "extension". Right now we allow XPL to be called with the XPath xxforms:call-xpl() function. We could extend this allow other type of functions to be called. But those functions would be defined on the server side, as the XPath is evaluated on the server side. To answer your question specifically, allowing a JavaScript function defined in the HTML to be called from XPath would be "difficult", and I don't think you should expect this to be implemented in the near future. 2) When you need to do more than when you can do in standard XPath, IMHO it is better to call a service: use a submission replace="instance" to call a pipeline or other endpoint that implements the piece of functionality you need. This is more portable, simpler to debug, and reusable. [1] http://www.w3.org/TR/xpath-functions/ Alex On 3/23/06, Adrian Baker <[hidden email]> wrote: > Do you see this as temporary limitation of OPS which might be later > implemented, or a permanent restriction? > > > Alessandro Vernet wrote: > You cannot call JavaScript this way from XForms. Two alternatives come to > mind: > > 1) If your logic is simple enough, you could write it in XPath. We use > XPath 2.0, so you can do pretty sophisticated just with XPath. > > 2) If the logic is more complex, you can trigger a submission > replace="instance" and have the value calculated on the server-side by > a "service". > > Alex > > On 3/22/06, [hidden email] <[hidden email]> wrote: > > > Good day everyone. > > I have the following problem: developing an application using Orbeon > Presentation Server (aka OPS), I need an additional action to be performed > using simple javascript code. I know at this stage, that javascript chunks > can be declared between <script> and </script> tags. But, as I tried, I can > only call a function when page loads. The documentation regarding this > problem is still unaccessible for me (perhaps it doesn't exist). I have > found something regarding this: > > <xhtml:script> > function javascriptfuction() > { > ... > } > </xhtml:script> > > <xforms:input ...> > <xforms:action ev:event="xforms-value-changed"> > ... > <xforms:setvalue ref="instance('dummy')/dummy" > value="inline:javascriptfuction()"> > </xforms:action> > </xforms:input> > > But it tells me that "inline" prefix is not defined. > Can anyone help me? > > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > ________________________________ > > -- 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 ObjectWeb > mailing lists service home page: http://www.objectweb.org/wws > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Unfortunately in this case it's not that I have complex logic I can't tackle with XPath (I agree, this is better done server side). Rather all I need to do is invoke a javascript function in an adjoining frame, which can only be done from the client. That's ok, there's several ways I can still achieve this (or I can leave the page in it's current HTML+JavaScript state) - I was more interested in your longer term position on this. A call to JavaScript from XPath does sound like a headscratcher, but what about a block of script which was invoked by a xml event? eg (this is from XForms Essentials): <xhtml:head> <xhtml:script type="text/javascript" ev:event="click" ev:observer="btn">...</xhtml:script> ... </xhtml:head> When appropriate the server would just have to notify the client of the event firing via the javascript response handler, which would then invoke the custom script. Obviously if the script had to interact with the DOM, it would be dealing with the OPS-generated DOM rather than the server side XHTML+XForms DOM. Plus I guess the ordering of the script firing in relation to server side event handling would be pretty much fixed (ie, always after server side events), but as long as these limitations were clearly published this could be very useful for unfortunate corner cases when javascript invocation is required. Adrian Alessandro Vernet wrote: Adrian, In XForms, in a number of places you can use XPath expressions. In those XPath expressions you can use any of the function defined in the "XQuery 1.0 and XPath 2.0 Functions and Operators" specification [1]. When those functions are not enough, you can either: 1) Call an "extension". Right now we allow XPL to be called with the XPath xxforms:call-xpl() function. We could extend this allow other type of functions to be called. But those functions would be defined on the server side, as the XPath is evaluated on the server side. To answer your question specifically, allowing a JavaScript function defined in the HTML to be called from XPath would be "difficult", and I don't think you should expect this to be implemented in the near future. 2) When you need to do more than when you can do in standard XPath, IMHO it is better to call a service: use a submission replace="instance" to call a pipeline or other endpoint that implements the piece of functionality you need. This is more portable, simpler to debug, and reusable. [1] http://www.w3.org/TR/xpath-functions/ Alex On 3/23/06, Adrian Baker [hidden email] wrote:Do you see this as temporary limitation of OPS which might be later implemented, or a permanent restriction? Alessandro Vernet wrote: You cannot call JavaScript this way from XForms. Two alternatives come to mind: 1) If your logic is simple enough, you could write it in XPath. We use XPath 2.0, so you can do pretty sophisticated just with XPath. 2) If the logic is more complex, you can trigger a submission replace="instance" and have the value calculated on the server-side by a "service". Alex On 3/22/06, [hidden email] [hidden email] wrote: Good day everyone. I have the following problem: developing an application using Orbeon Presentation Server (aka OPS), I need an additional action to be performed using simple javascript code. I know at this stage, that javascript chunks can be declared between <script> and </script> tags. But, as I tried, I can only call a function when page loads. The documentation regarding this problem is still unaccessible for me (perhaps it doesn't exist). I have found something regarding this: <xhtml:script> function javascriptfuction() { ... } </xhtml:script> <xforms:input ...> <xforms:action ev:event="xforms-value-changed"> ... <xforms:setvalue ref="instance('dummy')/dummy" value="inline:javascriptfuction()"> </xforms:action> </xforms:input> But it tells me that "inline" prefix is not defined. Can anyone help me? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ ________________________________ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws-- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Adrian,
Calling JavaScript that you want to execute on the client side against the HTML page generated on the server-side is certainly a valid use case. You could use an indirect method: for instance get the XForms code to change the value of an input field and listen to a change in your own JavaScript. But essentially we don't have a recommended solution at this point, so we are open to suggestions :). Alex On 3/27/06, Adrian Baker <[hidden email]> wrote: > Hi Alex, > > Unfortunately in this case it's not that I have complex logic I can't > tackle with XPath (I agree, this is better done server side). Rather all I > need to do is invoke a javascript function in an adjoining frame, which can > only be done from the client. That's ok, there's several ways I can still > achieve this (or I can leave the page in it's current HTML+JavaScript state) > - I was more interested in your longer term position on this. > > A call to JavaScript from XPath does sound like a headscratcher, but what > about a block of script which was invoked by a xml event? eg (this is from > XForms Essentials): > > <xhtml:head> > <xhtml:script type="text/javascript" ev:event="click" > ev:observer="btn">...</xhtml:script> > ... > </xhtml:head> > > When appropriate the server would just have to notify the client of the > event firing via the javascript response handler, which would then invoke > the custom script. > > Obviously if the script had to interact with the DOM, it would be dealing > with the OPS-generated DOM rather than the server side XHTML+XForms DOM. > Plus I guess the ordering of the script firing in relation to server side > event handling would be pretty much fixed (ie, always after server side > events), but as long as these limitations were clearly published this could > be very useful for unfortunate corner cases when javascript invocation is > required. > > Adrian > > > Alessandro Vernet wrote: > Adrian, > > In XForms, in a number of places you can use XPath expressions. In > those XPath expressions you can use any of the function defined in the > "XQuery 1.0 and XPath 2.0 Functions and Operators" specification [1]. > When those functions are not enough, you can either: > > 1) Call an "extension". Right now we allow XPL to be called with the > XPath xxforms:call-xpl() function. We could extend this allow other > type of functions to be called. But those functions would be defined > on the server side, as the XPath is evaluated on the server side. To > answer your question specifically, allowing a JavaScript function > defined in the HTML to be called from XPath would be "difficult", and > I don't think you should expect this to be implemented in the near > future. > > 2) When you need to do more than when you can do in standard XPath, > IMHO it is better to call a service: use a submission > replace="instance" to call a pipeline or other endpoint that > implements the piece of functionality you need. This is more portable, > simpler to debug, and reusable. > > [1] http://www.w3.org/TR/xpath-functions/ > > Alex > > On 3/23/06, Adrian Baker <[hidden email]> wrote: > > > Do you see this as temporary limitation of OPS which might be later > implemented, or a permanent restriction? > > > Alessandro Vernet wrote: > You cannot call JavaScript this way from XForms. Two alternatives come to > mind: > > 1) If your logic is simple enough, you could write it in XPath. We use > XPath 2.0, so you can do pretty sophisticated just with XPath. > > 2) If the logic is more complex, you can trigger a submission > replace="instance" and have the value calculated on the server-side by > a "service". > > Alex > > On 3/22/06, [hidden email] <[hidden email]> wrote: > > > Good day everyone. > > I have the following problem: developing an application using Orbeon > Presentation Server (aka OPS), I need an additional action to be performed > using simple javascript code. I know at this stage, that javascript chunks > can be declared between <script> and </script> tags. But, as I tried, I can > only call a function when page loads. The documentation regarding this > problem is still unaccessible for me (perhaps it doesn't exist). I have > found something regarding this: > > <xhtml:script> > function javascriptfuction() > { > ... > } > </xhtml:script> > > <xforms:input ...> > <xforms:action ev:event="xforms-value-changed"> > ... > <xforms:setvalue ref="instance('dummy')/dummy" > value="inline:javascriptfuction()"> > </xforms:action> > </xforms:input> > > But it tells me that "inline" prefix is not defined. > Can anyone help me? > > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > ________________________________ > > -- 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 ObjectWeb > mailing lists service home page: http://www.objectweb.org/wws > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > > > > -- > Blog (XML, Web apps, Open Source): > http://www.orbeon.com/blog/ > > > > ________________________________ > > -- 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 ObjectWeb > mailing lists service home page: http://www.objectweb.org/wws > > > > -- > 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 > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws > > > -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi everyone.
I have had a fruitful presentation this monday concerning xforms in our project, which will be backended by OPS. Thanks Mr. Puddephatt for providing some useful information. The autocomplete control is released on the 'night-build'. The first question: when this build will become an official one? But, back to the problem raised regarding javascript. The autocomplete control needs still work over it. First, when I erase characters from the input field, the autocomplete is not displaying. Second, I have in my example over 10.000 suggestions (for instance, there are medicare codes), and will never load them in the instance. I decided to do this dynamically, using 'xforms-value-changed' event, which listens keystrokes and loads only few suggestions at a time. Many observations here! The main headache is the -=SAME=- event for input typing and suggestion selection from autocomplete select! This means, when selecting a suggestion, server is requested again (!) to provide suggestion set. Also, each selected value is backended with an SID (internal code), which is set to be stored in the main instance by listening 'xforms-value-changed' event. Er, the SID is populated immediately with first possible suggestion on their arrival, even if that suggestion is not yet selected. Hope these details will be fixed in the nearest future. Going further. In the form I have to develop, there are many dynamic parts, which will be replaced/show/hidden depending on some conditions. Everything must be done client-side. This is why I need a javascript to be called on some events. Yes, this javascript is needed ONLY for DOM operation, hiding XHTML span-s and div-s; here I don't see the legal XPath replacement, for the moment. Server-side processing is excluded due to usability issues. In conclusion, I need a method to hide or show span-s, even layered, by their id. Please help me. Regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
In reply to this post by alhaziz
To moderator:
There is another topic with the same name started by same person (that's me), please attach it to this conversation. Regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by alhaziz
On 3/28/06, [hidden email] <[hidden email]> wrote:
> The autocomplete control is released on the 'night-build'. The first question: > when this build will become an official one? Expect this to be done in the next few weeks. There are a couple more features that we would like to put in before we release a new version. But in the meantime, you can use the automated builds. We are trying our best not to have any regression compared to the latest release, and if you notice any, please let us know in this list and we'll try to fix that ASAP. > But, back to the problem raised regarding javascript. > First, when I erase characters from the input field, > the autocomplete is not displaying. This is by design. But I don't have a strong opinion either way. If you provide an argument of why the list should still display when you delete a character and if nobody objects, we can certainly change the current behavior. > This means, when selecting a suggestion, server is requested > again (!) to provide suggestion set. I don't know if there is a way around this with XForms. But it should not have a huge practical impact as this is just one additional request. > Also, each selected value is backended with an SID (internal code), > which is set to be stored in the main instance by listening > 'xforms-value-changed' event. Er, the SID is populated immediately > with first possible suggestion on their arrival, even if that suggestion > is not yet selected. I am not sure what the problem is there. Could you please clarify? > In conclusion, I need a method to hide or show span-s, even > layered, by their id. Please help me. In general we use either: 1) An <xforms:switch>, with <xforms:case> and <xforms:toggle> 2) or <xforms:group> bound to a node that has a bind saying if that node is relevant or not. If the node is not relevant, then the corresponding group will not be displayed. Alex -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
In reply to this post by alhaziz
On 3/28/06, [hidden email] <[hidden email]> wrote:
> To moderator: > > There is another topic with the same name started by same > person (that's me), please attach it to this conversation. This is a mailing list and (unlike some online forums), we cannot move messages around or delete messages. Once your message is sent, it is sent :). But don't worry if your other message is not in the same thread, people we'll figure it out. Alex -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by Alessandro Vernet
> > But, back to the problem raised regarding javascript.
> > First, when I erase characters from the input field, > > the autocomplete is not displaying. > > This is by design. But I don't have a strong opinion either way. If > you provide an argument of why the list should still display when you > delete a character and if nobody objects, we can certainly change the > current behavior. The main reason is because we are programming FOR USERS, which can freely push two buttons at one time, providing a keyphrase which haven't any suggestions at all. When erasing unwanted character, the suggestions popup must be ready... But, rather than providing these arguments, I would like to know what lines of code can I modify to achieve the requested behaviour. This is because I foresee another problem: some suggestions will be so many even if keyphrase already contains 3 letters. Thus, I need to stop autosuggestion if there are less than 3 characters present in the input field. An idea: if you plan to do some modifications, all such options can be parametrized by tag attributes, like input's incremental="true". This will kill many birds with one stone ;-) > > This means, when selecting a suggestion, server is requested > > again (!) to provide suggestion set. > I don't know if there is a way around this with XForms. But it should > not have a huge practical impact as this is just one additional request. About huge impact: it will have, just imagine over 10.000 suggestions (and that was only prototype!). Here, if possible, would be nice to have 2 separate events: one for input typing and one for suggestion selection. > > Also, each selected value is backended with an SID (internal code), > > which is set to be stored in the main instance by listening > > 'xforms-value-changed' event. Er, the SID is populated immediately > > with first possible suggestion on their arrival, even if that suggestion > > is not yet selected. > > I am not sure what the problem is there. Could you please clarify? The test sandbox: an autocomplete control and an output displaying associated SID. Initially, input is empty, output too. Typing the first character. After a meanwhile, here some suggestions appear beneath the input. Immediately, the output displays SID of the first suggestion from autocomplete box! Can not provide the code, I am not in the office now. Tomorrow will attach it. Finally, > In general we use either: > > 1) An <xforms:switch>, with <xforms:case> and <xforms:toggle> > 2) or <xforms:group> bound to a node that has a bind saying if that > node is relevant or not. If the node is not relevant, then the > corresponding group will not be displayed. The switch control is not suitable for the situation. But, please tell me: can the group bound to a node to be set as layered (like old way: style="position:absolute; z-index=1000;")? Best regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
[hidden email] wrote:
The group tag results in a <span> which you can style how you want:Finally,In general we use either: 1) An <xforms:switch>, with <xforms:case> and <xforms:toggle> 2) or <xforms:group> bound to a node that has a bind saying if that node is relevant or not. If the node is not relevant, then the corresponding group will not be displayed.The switch control is not suitable for the situation. But, please tell me: can the group bound to a node to be set as layered (like old way: style="position:absolute; z-index=1000;")? <xforms:group xhtml:class="myClass" ref="xyz> ... Alternatively you can wrap you own <div>/<span>/ whatever in the group and style that: <xforms:group ref="xyz"> <xhtml:div xhtml:class="myClass"> ... Adrian -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by alhaziz
On 3/28/06, [hidden email] <[hidden email]> wrote:
> The main reason is because we are programming FOR USERS, which > can freely push two buttons at one time, providing a keyphrase which > haven't any suggestions at all. When erasing unwanted character, > the suggestions popup must be ready... OK, I have added a bug for this, and we'll look at it when we get a chance. http://forge.objectweb.org/tracker/index.php?func=detail&aid=304872&group_id=168&atid=350207 > But, rather than providing these arguments, I would like to know > what lines of code can I modify to achieve the requested behaviour. I can't give you the exact line you need to modify, but I can point you to the file. It is ops\javascript\suggest-actb.js in the resources. If you are successfully with this change, please share your modified version with us :). > About huge impact: it will have, just imagine over 10.000 suggestions > (and that was only prototype!). Here, if possible, would be nice to have > 2 separate events: one for input typing and one for suggestion selection. If you have 10,000 suggestions, you might want to limit the number of suggestions sent to the client in the first place, instead of have this functionality built in the auto-complete control. This is something we do in the countries.xpl, which is used by the XForms controls example. There we limit the number of countries returned to 10. > The test sandbox: an autocomplete control and an output displaying > associated SID. Initially, input is empty, output too. Typing the first > character. After a meanwhile, here some suggestions appear beneath > the input. Immediately, the output displays SID of the first suggestion > from autocomplete box! > Can not provide the code, I am not in the office now. > Tomorrow will attach it. I think I understand the problem, but will look at your code tomorrow. > The switch control is not suitable for the situation. But, please tell me: > can the group bound to a node to be set as layered (like old way: > style="position:absolute; z-index=1000;")? Yes, and I recommend that instead of putting the style on the <xforms:group>, you add an <xhtml:div> directly inside the group that contains your style. Alex -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
> > The main reason is because we are programming FOR USERS, which
> > can freely push two buttons at one time, providing a keyphrase which > > haven't any suggestions at all. When erasing unwanted character, > > the suggestions popup must be ready... > > OK, I have added a bug for this, and we'll look at it when we get a chance. > > http://forge.objectweb.org/tracker/index.php?func=detail&aid=304872&group_id=168&atid=350207 Thank you. > > About huge impact: it will have, just imagine over 10.000 suggestions > > (and that was only prototype!). Here, if possible, would be nice to have > > 2 separate events: one for input typing and one for suggestion selection. > > If you have 10,000 suggestions, you might want to limit the number of > suggestions sent to the client in the first place, instead of have > this functionality built in the auto-complete control. This is > something we do in the countries.xpl, which is used by the XForms > controls example. There we limit the number of countries returned to 10. Here is a misunderstanding here, so let's see how it works. Let us take countries as example. I type 'D' key in the input field, and an event is sent to server to provide all countries starting with that letter (this is because I don't want to overpopulate the main instance with all possible variants). Then, I go with mouse or arrow keys and select a suitable variant, let it be DENMARK. Note, the server is asked again to provide an autocomplete list for the keyphrase DENMARK, which will be only 1 variant; but in this case autocomplete box is not displayed and you cannot see this. There is code attached (I promised to do) on the end of this message. > > The test sandbox: an autocomplete control and an output displaying > > associated SID. Initially, input is empty, output too. Typing the first > > character. After a meanwhile, here some suggestions appear beneath > > the input. Immediately, the output displays SID of the first suggestion > > from autocomplete box! > > Can not provide the code, I am not in the office now. > > Tomorrow will attach it. > > I think I understand the problem, but will look at your code tomorrow. Here is the code: ================ <xforms:group> <xforms:label>Diagnosis Code</xforms:label> <xhtml:p> <xforms:select1 ref="diagnosiscode/name" selection="open" incremental="true" appearance="xxforms:autocomplete"> <xforms:label class="fixed-width">Enter:</xforms:label> <xforms:itemset nodeset="instance('suggestions')/suggestion"> <xforms:value ref="caption"/> <xforms:label ref="caption"/> </xforms:itemset> <xforms:action ev:event="xforms-value-changed"> <xforms:setvalue ref="instance('suggestions')/@sender" value="'diagnosiscode'"/> <xforms:setvalue ref="instance('suggestions')/@letters" value="instance('instance')/diagnosiscode/name"/> <xforms:send submission="autocomplete-submission"/> <xforms:setvalue ref="instance('instance')/diagnosiscode/sid" value="instance('suggestions')/suggestion/sid"/> </xforms:action> </xforms:select1> </xhtml:p> <xhtml:p> <xhtml:span>SID:</xhtml:span> <xforms:output ref="diagnosiscode/sid"/> </xhtml:p> </xforms:group> ====================== And some related stuff: ======================== <!--INSTANT SUBMISSION--> <xforms:submission method="post" id="autocomplete-submission" ref="instance('suggestions')" action="/xforms-autocomplete/suggest" replace="instance"/> <!--SUGGESTION INSTANCE (sent to server to provide some of them)--> <!--'letters' contains user input to autocomplete --> <!--'sender' contains the idstring of control which is requesting suggestion--> <!--And comes back with populated suggestion set--> <xforms:instance id="suggestions"> <suggestions letters="." id="." sender="."/> </xforms:instance> ======================== > > The switch control is not suitable for the situation. But, please tell me: > > can the group bound to a node to be set as layered (like old way: > > style="position:absolute; z-index=1000;")? > > Yes, and I recommend that instead of putting the style on the > <xforms:group>, you add an <xhtml:div> directly inside the group that > contains your style. Thank you, works indeed! Best regards, Al.Haziz. -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
On 3/29/06, [hidden email] <[hidden email]> wrote:
> Here is a misunderstanding here, so let's see how it works. > Let us take countries as example. I type 'D' key in the input field, > and an event is sent to server to provide all countries starting > with that letter (this is because I don't want to overpopulate the > main instance with all possible variants). Then, I go with mouse > or arrow keys and select a suitable variant, let it be DENMARK. > Note, the server is asked again to provide an autocomplete list > for the keyphrase DENMARK, which will be only 1 variant; but > in this case autocomplete box is not displayed and you cannot > see this. There is code attached (I promised to do) on the end > of this message. XForms, the event we receive when the user has selected a value from the list is the same as the one we receive when the user has typed a character. In both cases we receive an xforms-value-changed. If when a character is typed we change the itemset to only match countries that include that additional character, we'll just have to do the same thing when a country is selected from the list. So when a country from the list is selected, we'll update the itemset to only include that country. This is unnecessary, as the list is not displayed, but it doesn't cause any problem visible to the user. It just makes a final unnecessary request, and I don't see a way around this. Alex -- Blog (XML, Web apps, Open Source): http://www.orbeon.com/blog/ -- 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 ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |