Hi,
Is it ok to limit the size of a text area like this? (since xxforms:size does not work on textareas)? <script language="javascript" type="text/javascript"> var textarea1 = document.getElementById("PREFERED_CALL_TIME"); textarea1.onkeydown=function () { var val = ORBEON.xforms.Document.getValue("PREFERED_CALL_TIME"); if(val.length >= 10) ORBEON.xforms.Document.setValue("PREFERED_CALL_TIME", val.substring(0,9)); }; </script> Is there a better way? Are there any unexpected by-products of this approach? Thanks Nicolas |
You can use xforms:bind to limit the length of an element based on string-length().
For example <xforms:bind nodeset="textarea"> <xforms:bind constraint="string-length(.) < 100"/> </xforms:bind> If you want to do it with xforms rather than javascript. On Thu, Jun 24, 2010 at 1:26 PM, npujol73 <[hidden email]> wrote:
-- 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 |
In reply to this post by npujol73
Please do not make a double post ! In any global forum they wont encourage this type of activity !
|
In reply to this post by Ethan Gruber
Thanks Ethan. The issue with that approach is that the user can keep typing and does not find out about the length requirement until moving over to another field.
|
In reply to this post by karthik Jayaraman
Thanks Ethan. The issue with that approach is that the user can keep typing and does not find out about the length requirement until moving over to another field.
|
Administrator
|
Nicolas,
You could add an incremental="true" on the field, so updates are taken into account as users type. And if you want, you could even have an <xforms:output value="..."/> next to the text area that shows how many characters are remaining. Alex On Thu, Jun 24, 2010 at 3:54 PM, npujol73 <[hidden email]> wrote: > > Thanks Ethan. The issue with that approach is that the user can keep typing > and does not find out about the length requirement until moving over to > another field. > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Limiting-the-size-of-xforms-textarea-tp2267345p2267791.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Will the addition of the incremental attribute result in a server call
on every keystroke? Thanks Nicolas On Jun 25, 2010, at 7:09 PM, Alessandro Vernet <[hidden email]> wrote: > Nicolas, > > You could add an incremental="true" on the field, so updates are taken > into account as users type. And if you want, you could even have an > <xforms:output value="..."/> next to the text area that shows how many > characters are remaining. > > Alex > > On Thu, Jun 24, 2010 at 3:54 PM, npujol73 <[hidden email]> > wrote: >> >> Thanks Ethan. The issue with that approach is that the user can >> keep typing >> and does not find out about the length requirement until moving >> over to >> another field. >> -- >> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Limiting-the-size-of-xforms-textarea-tp2267345p2267791.html >> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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 >> >> > > > > -- > Orbeon Forms - Web forms, open-source, for the Enterprise - > http://www.orbeon.com/ > My 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 -- 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 |
I don't know the ins and outs of this like Erik and Alex do, but if I had to guess, the javascript is executed client-side in the browser.
Ethan On Fri, Jun 25, 2010 at 10:53 PM, Nicolas Pujol <[hidden email]> wrote: Will the addition of the incremental attribute result in a server call -- 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 |
Administrator
|
In reply to this post by npujol73
Nicolas,
Yes and no: the text is sent to the server after a short delay. So you won't quite get one Ajax call per keystroke, but you'll get more calls than if you didn't have the incremental="true". Alex On Fri, Jun 25, 2010 at 7:53 PM, Nicolas Pujol <[hidden email]> wrote: > Will the addition of the incremental attribute result in a server call > on every keystroke? > > Thanks > > > Nicolas > > On Jun 25, 2010, at 7:09 PM, Alessandro Vernet <[hidden email]> > wrote: > >> Nicolas, >> >> You could add an incremental="true" on the field, so updates are taken >> into account as users type. And if you want, you could even have an >> <xforms:output value="..."/> next to the text area that shows how many >> characters are remaining. >> >> Alex >> >> On Thu, Jun 24, 2010 at 3:54 PM, npujol73 <[hidden email]> >> wrote: >>> >>> Thanks Ethan. The issue with that approach is that the user can >>> keep typing >>> and does not find out about the length requirement until moving >>> over to >>> another field. >>> -- >>> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Limiting-the-size-of-xforms-textarea-tp2267345p2267791.html >>> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.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 >>> >>> >> >> >> >> -- >> Orbeon Forms - Web forms, open-source, for the Enterprise - >> http://www.orbeon.com/ >> My 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 > > > -- > 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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ My 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |