| Post |
|
Guest
| Manish 3:05 pm June 16, 2007
| |
|
|
Hi,
I was wondering if this plugin allows to auto fill certain data/fields for logged-in users like Name, Email etc. that already the user has filled while registering.
Or perhaps if you could suggest a way to put a php code in the fields in form settings page, just like you have variables {VariableName}
regards,
Manish
|
|
|
Admin
| Oliver Munich, Germany posts 6096 5:21 pm June 17, 2007
| |
|
|
cforsm fully supports "default values", see the Help! section. The format for the field names is name|default value|etc….
|
|
|
|
|
Guest
| Manish 6:58 pm June 17, 2007
| |
|
|
Dear Oliver, I guess my query was not properly understood.
I need to auto fill certain data of the user in the contact form. Basically this data is what user had already provided during registration
like his Email, Name, City, Country, Phone etc. I dont want the registered and logged-in user to fill this data again.
How can this be done. Is there a way to add some PHP code to the form.
|
|
|
Admin
| Oliver Munich, Germany posts 6096 10:15 pm June 17, 2007
| |
|
|
Sorry, I misread your question. The answer remains yes, though. However, to accomplish this, you'll have to use dynamic forms. There are examples (under Help!) of how to make use of this feature by using appropriate PHP code and function call to render the form(s) at runtime. This way you can determine individually what needs to go into the default values.
insert_custom_cform( $fields:array, $form-no:int );
|
|
|
|
|
Guest
| Manish 7:40 am June 18, 2007
| |
|
|
Thanks Oliver. I will try to experiment with dynamic forms, but truely speaking, I am not very sure if I would be able to do it without your help. But I understand, you cannot provide customized solutions to everyone, still I would like to request you in case this problem/requirement has been dealt earlier, then kindly point me in that direction.
It surely is a very nice plugin. If you like, I can put a review of this plugin on http://www.ktpl.com
regards.
|
|
|
Admin
| Oliver Munich, Germany posts 6096 7:47 am June 18, 2007
| |
|
|
No problem Manish, just use this thread for follow ups. I'll be traveling all this week, so I probably won't be able to respond before Friday.
|
|
|
|
|
Guest
| Manish 9:14 am June 23, 2007
| |
|
|
1. I read the help section but cudnt understand where to insert cutom field/form ?
2. Is it possible to add php code, say to validate input of a particular field, if the form is generated using cforms control panel ?
|
|
|
Admin
| Oliver Munich, Germany posts 6096 10:42 am June 23, 2007
| |
|
|
to 1:
you need to add the respective PHP code for inserting the form to one of your PHP WP theme templates, e.g. page.php, single.php, search.php etc. (or create a new, specific one for a custom contact page), the Help! section shows the function call needed to insert the form.
to 2:
field validation is done via regular expressions, they can also be added during run-time (when the form is put together). so you can determine the regular expression for a given field before, but you can not programatically add custom PHP code to be executed AFTER form submission. hope that makes sense.
|
|
|
|
|
Guest
| Manish 12:25 pm June 25, 2007
| |
|
|
Regarding validation of field : Ok I get the idea. But just in case if you can help me with some example, say I need to accept a number from a user between 1 and 3000, how can I do it with reg exp.
|
|
|
Admin
| Oliver Munich, Germany posts 6096 5:44 pm June 25, 2007
| |
|
|
Have you seen the regexp documentation (and link to a regex portal) on the Help page? Try the link, the portal has some thousands of pre-made regexps.
In this case, I'd try: ^([0-9]{1}|[0-9]{2}|[0-9]{3}|[0-2]?[0-9]{3}|3000)$
This should cover all one digit, two digit, …numbers up to 3000.
|
|
|
|
|
Guest
| Manish 2:40 pm June 27, 2007
| |
|
|
Thanks for showing me the correct direction :-)
|
|