cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Auto fill fields for logged-in users
June 16, 2007
3:05 pm
Manish
Guest

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

June 17, 2007
5:21 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

cforsm fully supports "default values", see the Help! section.  The format for the field names is name|default value|etc….

June 17, 2007
6:58 pm
Manish
Guest

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. 

June 17, 2007
10:15 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

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 );

June 18, 2007
7:40 am
Manish
Guest

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. Smile

It surely is a very nice plugin. If you like, I can put a review of this plugin on http://www.ktpl.com 

 regards.

June 18, 2007
7:47 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

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.

June 23, 2007
9:14 am
Manish
Guest

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 ? 

June 23, 2007
10:42 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

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.

June 25, 2007
12:25 pm
Manish
Guest

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.

June 25, 2007
5:44 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

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. 

June 27, 2007
2:40 pm
Manish
Guest

Thanks for showing me the correct direction :-)

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3762

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5359

Posts: 18741

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)