cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




Populating Fields - Custom

Add a New Topic Reply to Post
Post

CyberWoolf - Guest

1:43 am - August 14, 2008

I'm trying to figure out if this is possible or not...

The plan: 

A user fills out a form (only registered).  It saves to the DB.  When the user logs back in and goes to the page with the form, it populates the fields with the form data from the previous time they were there.

 

I have the registered part and the db part down.  I just want to know if it would be possible and if so.. where should I look in the docs?  I tried to use the variables for the email in the docs but it didnt work :-D

Also.. can you make me some pizza?  I get hungry everytime I come here!!  :-)

Oliver - Admin

7:42 am - August 14, 2008

posts 3656

When the user logs back in and goes to the page with the form, it populates the fields with the form data from the previous time they were there.

not sure I understand, but here is my take:

  • form is only shown (via PHP in the theme template file) for logged in users
  • fields are being prepopulated with the data from the last submission?
  •  
    •  if so, you need to first retrieve the data from the DB
    • then feed it into a custom, dynamic form (on the fly setup)
  • otherwise, field input can also be saved by browsers

Alternative: you can of course modify the handling of the check_default_vars() in lib_aux.php and extend by your own fields e.g. {CW_field1} would have to be resolved by the above function by retrieving the data from the DB and returning this value.

Then you could simply use in your form field config string: field1|{CW_field1}

Future: I'm planning on adding two more filters to my-functions.php:

  • (a) pre rendering filter (to fill in default data from anywhere)
  • (b) pre validation filter (to influence field validation)

Also.. can you make me some pizza?  I get hungry everytime I come  here!!  :-)

hey this blog comes with recipes = manuals.

CyberWoolf - Guest

8:33 am - August 14, 2008

This is still the most amazing and comprehensive plugin I've found for any type of cms/blog/cart and am eternally thankful for it.  Plus I love the fact your respond to every post.


The second option is more what I am going for.  So if I wanted to take the users City, would I add something like:

$m  = str_replace( '{CW_City}',$CurrUser->City, $m );


where the ->City would be the field name I entered in cforms.  Sorry my coding is rusty.  I'm usually skinning systems   :-D


I have browsed though some of the recipes!  It does look yummy.  I just surprised my family a couple weeks ago by making a really good artichoke dip.  They couldn't believe that *I* made it!

Oliver - Admin

8:57 pm - August 14, 2008

posts 3656

Provided that ->City is a valid attribute, you're right.

Add a New Topic Reply to Post


Reply to Topic: Populating Fields - Custom
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 9 + 9        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.3 (Build 356)