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
Inserting Custom Fields
November 30, 2007
10:18 pm
Mark
Guest

Please replace the ??? with your data!

  • Your URL: In progress
  • The browser used: All
  • cforms version: 6
  • Your Wordpress version: 2.3

Hi Oliver, I'm using your fantastic plugin to create a job board, and have a requirement to include a wordpress custom field into the form. I have set up a custom field for the Job Reference number, and would like to have the custom field display as part of the form, and submitted to the admin.

I have had success using the {page} variable, but would like to have a little more control over the data that is sent.

The ability to somehow include wordpress custom fields would send me into another planet of wordpress goodness :)

Any assistance you could offer would be greatly appreciated!

Thanks,

Mark_

December 1, 2007
12:18 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

You could make use of dynamic forms. See the Help page for examples on how to use this feature.

As part of your PHP script you can then feed your custom field data into specific form fields. Via CSS (display:none;) you can decide whether you want the user to see those or not.

For v6.4 I will add the possibility to define 'hidden' fields as well.

 

December 2, 2007
12:20 am
Mark
Guest

Thanks Oliver, I think I might just have to wait for version 6.4 :)

Unfortunately my level of experience with php doesn't give me much hope of using dynamic forms for this purpose, although I'll most probably read the help section on that word for word a few times!

I must add that the level of support you're providing for this plugin is fantastic – an example for all the other plugin developers out there! Thanks! 

December 2, 2007
12:43 am
Mark
Guest

Actually, just thinking more about this, I don't think the hidden fields function will do what I need it to do (although it will be very helpful for other applications).

The reason for this is that the site admin will be choosing the same application form for every job. Therefore if I do use a hidden field, it's still going to need to grab the job reference number from the post's custom field. 

Oh how I wish I knew a bit more about php! If anyone could give me some ideas, that would be fantastic. Generally, I reckon that the ability to use custom fields with this plugin would be just amazing.  

December 2, 2007
8:23 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

Mark said:

The reason for this is that the site admin will be choosing the same application form for every job. Therefore if I do use a hidden field, it’s still going to need to grab the job reference number from the post’s custom field.

 


I think you still could use the hidden field, you could even be fine with the current release of cforms if (a) you don't mind showing the 'job reference number' to the user or (b) don't mind if it's only visually hidden via CSS.

The way the dynamic form feature works, is that you create the fields (and all the parameters) at run-time, your online form field config will be disregarded.

Hence you can determine (inside your single.php template) the default value of the form field 'job reference #' via a PHP call just before rendering the form and feed this to the form fields array (see Helppage).

Here is what I would do:

  1. Your job posts include a custom field, indicating the job ref #
  2. The application form is only shown on the single page, users have to click on 'more' or simply select a link that points to the single page
  3. In he single.php template I'd add PHP code, to:
    1. check if the current post is a job post (check category)
    2. retrieve the custom field data (job ref #)
    3. build up your form field array
    4. insert the form with cforms PHP call
  4. Make sure to place the above code (with the check) underneath the the_content call to show the form just below the post text

(hope I didn't miss anything)

 

PS: What is the URL

December 3, 2007
3:14 am
Mark
Guest

Hi Oliver,

Steps 1,2 and 4 above are no problem for me, howver, not being a programmer, Step 3 gives me a few nightmares :)

Do you mind if I email you the URL? It's a bit commercially sensitive at the moment :)

Thanks,
Mark

December 3, 2007
7:44 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

That's fine.

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
41 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: 3744

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5345

Posts: 18714

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

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

Administrators: Oliver (6400), Nicky (3)