Hi,
I'm trying to figure out a way to trim entered text in inputs, so to remove spaces around input and also to regard just spaces as not being valid input. So far I've come up with binds having a constraint="normalize-space(.) != ''" but that doesn't trim and goes for required fields only. Is there a standard, preferably general way of accomplishing this? Thanks, Jeroen -- 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
|
Jeroen,
On Feb 23, 2009, at 1:28 PM, Jeroen Hoffman wrote: > I'm trying to figure out a way to trim entered text in inputs, so > to remove spaces around input and also to regard just spaces as not > being valid input. > > So far I've come up with binds having a constraint="normalize-space > (.) != ''" but that doesn't trim and goes for required fields only. Would a <xforms:bind nodeset="//*" calculate="normalize-space(.)"/> work in your case? Maybe if you don't want to really trim everything in the instance, you can make that XPath expression a bit more restrictive. 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/ -- 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 |
Thanks for the suggestion, this stuff works!
Two comments: - an explicit readonly="false()" has to be set on the bind else the inputs are readonly, standard in case of a calculate I guess - I have some text areas that I do not want to be normalized, at least not the part where the internal sequences of white space are replaced by one space. I need a trim() but that doesn't exist :-(. So I ended up setting the calculate and readonly to all the applicable binds. // Jeroen Alessandro Vernet schreef: > Jeroen, > > On Feb 23, 2009, at 1:28 PM, Jeroen Hoffman wrote: > >> I'm trying to figure out a way to trim entered text in inputs, so to >> remove spaces around input and also to regard just spaces as not being >> valid input. >> >> So far I've come up with binds having a constraint="normalize-space(.) >> != ''" but that doesn't trim and goes for required fields only. > > Would a <xforms:bind nodeset="//*" calculate="normalize-space(.)"/> work > in your case? Maybe if you don't want to really trim everything in the > instance, you can make that XPath expression a bit more restrictive. > > 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/ > -- 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
|
Jeroen,
On Feb 24, 2009, at 1:25 AM, Jeroen Hoffman wrote: > Two comments: > - an explicit readonly="false()" has to be set on the bind else the > inputs are readonly, standard in case of a calculate I guess Right, good point. > - I have some text areas that I do not want to be normalized, at > least not the part where the internal sequences of white space are > replaced by one space. I need a trim() but that doesn't exist :-(. > So I ended up setting the calculate and readonly to all the > applicable binds. I imagine you could do the trim with a regular expression in the replace() function. 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 |
Free forum by Nabble | Edit this page |