Hey all, Another question. How do you trim a form field with dtml? I have JavaScript doing it when the form is submitted, but that doesn't help much for those browsers whose user's have disabled JavaScript. In ColdFusion, or even the dreaded ASP, I had a Trim() function at my disposal. Is there something that I can do with dtml - possibly a python expression that I use in a <dtml-call expr=""> type thingy? Thanks in advance, Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
Hi Tommy!
Another question. How do you trim a form field with dtml? I have JavaScript doing it when the form is submitted, but that doesn't help much for those browsers whose user's have disabled JavaScript.
A string is a sequence type, so you can do a simple <dtml-var "my_string[:10]"> to trim your field input (first 10 characters, in this case). Of course you can use a variable holding the length, instead of the integer literal 10... <dtml-call "REQUEST.set('my_string', 'this is way too long, man')"> <dtml-call "REQUEST.set('max_length', 6)"> <dtml-var "my_string[:max_length]"> will show up as "this i" Hope this helps, Danny
<dtml-call "REQUEST.set('formfield',_.string.strip(REQUEST['formfield']))"> at lot of writing for: <? $formfield = trim($formfiled) ; ?> but I bet you're a geek so you type fast.
Hey all,
Another question. How do you trim a form field with dtml? I have JavaScript doing it when the form is submitted, but that doesn't help much for those browsers whose user's have disabled JavaScript.
In ColdFusion, or even the dreaded ASP, I had a Trim() function at my disposal. Is there something that I can do with dtml - possibly a python expression that I use in a <dtml-call expr=""> type thingy?
Thanks in advance, Tommy
Innovation: The Best Way To Predict The Future ... Is To Create It.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
<dtml-call "REQUEST.set('formfield',_.string.strip(REQUEST['formfield']))"> at lot of writing for: <? $formfield = trim($formfiled) ; ?>
Thanks Peter, this is exactly what I needed
but I bet you're a geek so you type fast.
Well, you don't know me too well. Can't "type", but I can hunt ~n~ peck pretty quickly. ;> And I am NOT a geek! Well, maybe just a little, but we don't need to discuss that.... Anyway, thanks again, Tommy Innovation: The Best Way To Predict The Future ... Is To Create It.
participants (4)
-
Danny William Adair -
Peter Bengtsson -
Steve Drees -
Tommy Johnson