| Post |
|
Guest
| Jim 11:42 pm April 6, 2007
| |
|
|
Is there a way to specify a maximum of characters allowed to be entered in the mulitple lines of text part of the form? I need to limit people to 170 characters for their classified ads.
Thanks!
|
|
|
Admin
| Oliver Munich, Germany posts 6096 9:19 am April 7, 2007
| |
|
|
Jim said:
Is there a way to specify a maximum of characters allowed to be entered in the mulitple lines of text part of the form? I need to limit people to 170 characters for their classified ads.
Thanks!
Yes, Jim that's possible. Just setup a Multiple lines of text field and provide it with the following configuration:
170 chars max|your text|^.{1,170}$
- This will set the fields' label to: 170 chars max
- Provide a default text: your text
- And apply the regexp logic: ^.{1,170}$
Which essentially says: any character from start (^) to finish ($) is required at least once (1), and max 170 times
Hope this helps.
|
|
|
|
|
Guest
| Jim 7:08 pm April 24, 2007
| |
|
|
Hi Oliver,
I'm finally getting around to this and so far the # of characters is not stopping at 170. Here is what I put in the field for the multiple lines of text:
Your 1st ad:|170 chars max|^.{1,170}$
I also tried it as:
Your 1st ad: 170 chars max|^.{1,170}$
No luck. What am I missing?
Thanks,
Jim
|
|
|
Admin
| Oliver Munich, Germany posts 6096 8:08 pm April 24, 2007
| |
|
|
Sorry for the confusion Jim, the user can enter more characters but the form will not validate. Ie. to not confuse the user, you could add a text paragraph (text-only field) above this input field, highlighting the requirements for proper validation.
If the user enters more than the 170 characters (again, he/she can do that) the field will get a red border, the form is not sent. To actually control the text box to not let the user type in more than X characters requires more extensive JS coding and only works in JS enabled browsers.
From what I understadnd your point is to make sure more than X characters don't get submitted.
|
|
|
|
|
Guest
| Jim 8:41 pm April 24, 2007
| |
|
|
Hmmm… when I tested the form with over 170 chars, it still submitted the ad with the full 200+ characters, and I didn't get a red border as you mentioned. Here is the temp page if you want to look at it:
http://mtnneighbor.com/index.php/?page_id=5
Ah, yes it is easy to add the text to point out that they must only have 170 characters, but the hard part is making people read! Our current form ad submission page has a note saying TWO FREE ADS, and people seem to submit many more and wonder why we are then billing them. "Uh, I didn't see anything that said that."
If I can get it to do the red border and have the form not be sent with more than 170 chars, that would be just fine. (well, as long as people read why it might not be sending their tome.)
Thanks,
j
|
|
|
Admin
| Oliver Munich, Germany posts 6096 8:47 pm April 24, 2007
| |
|
|
I think I know what the issue is, check if you actually made the respective input fields "Is Required" on the main form admin page, otherwise the regular expression won't kick in.
PS: People are so used to only read the fine print (to not overlook something), so making this text paragraph a font: 6px; should do just fine ;)) kidding of course…
|
|
|
|
|
Guest
| Jim 9:23 pm April 24, 2007
| |
|
|
Excellent! That did the trick. I guess I should have read that part about those boxes being required.
btw, what great tech support! Too bad most major companies don't even comes close to the tech support quality you offer.
Cheers,
Jim
|
|
|
Guest
| Jim 12:34 am May 8, 2007
| |
|
|
Well,it seems some of our customers get a bit confused when they enter more than the allowed number of characters, get the red border, but the red border doesn't go away when they reduce the # of characters to the proper amount.
Apart from my writing an explaination for this, which they won't read, do you have suggestions? If the ability to stop a user fromentering more than x amount of characters isn't possible due to the js issue you mentioned, is is possible to get the form to not have the red border once they've reduced the words in their ad? I know you can hit refresh on the browser, but I really can't have a ton of instructions for the user.
tahnks,
Jim
|
|
|
Admin
| Oliver Munich, Germany posts 6096 7:24 am May 8, 2007
| |
|
|
Jim, anything you want the browser to change (look and feel, form structure, validation etc.) at run-time will have to be done by Javascript. Ie. to achieve the above, you'd have to write a script that polls every keystroke, counts all characters in the given field, compares them to what has been determined by the regular expressions (via the cforms form config) and changes the respective HTML elements accordingly.
It's doable, but not in a common/generic way. This would be a one-off. If this is critical to you, you may want to contact a have web developer to code you a script to be included.
|
|
|
|
|
Guest
| Jim 9:53 pm March 12, 2008
| |
|
|
Hallo Oliver, it seems this character limit method has stopped working, possibly with upgrade 7.0. Should it still work in current versions? The person entering our classified ads just alerted me to the problem, but didn't recall how long this has been happening. I sort of need to get that working again to stop people from rambling on in their classified ads.
Thanks,
Jim
|
|
|
Admin
| Oliver Munich, Germany posts 6096 7:03 am March 13, 2008
| |
|
|
Thank you for the heads-up, that bug must have slipped through my fingers…sorry for the inconvenience.
It'll be fixed in the v8 release coming [really] soon (w/ WP2.5 compliance).
If you need it right away, send me an email and I'll foward v8 to you.
|
|
|
|
|
Guest
| Rich 11:13 pm April 21, 2008
| |
|
|
Perhaps I'm confused…
If I want to limit a single-line text field, why can't I just set the size and maxlength attributes to the <input> tag? I can also do the regex for validation, but wouldn't the two attributes above (for single-line text input, not for multi-line) prevent someone from typing too much?
Rich
|
|
|
Admin
| Oliver Munich, Germany posts 6096 11:22 pm April 21, 2008
| |
|
|
Correct, the attributes would work for single line input fields. But the requirement was for multi-line text areas, and there is no size attribute for those.
|
|
|
|
|
Guest
| Rich 11:26 pm April 21, 2008
| |
|
|
That is correct, but for single-line text input, how do I incorporate the maxlength and size attributes, I can't figure out how to add those in Cforms.
Any help would be greatly appreciated.
Rich
|
|
|
Admin
| Oliver Munich, Germany posts 6096 6:47 am April 22, 2008
| |
|
|
well, that's not supported right now – sorry for raising your hopes. the general issue is, that there is so much that could be configured around forms & input fields its hard to get everything incorporated and yet maintain a half way intuitive user interface for configuration.
|
|
|
|