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
Hidden Fields
November 6, 2007
1:47 am
Tom
Guest

How do I generate a hidden field within the form? 

I've used the "disabled" option when creating the fields in the admin section, but the the input box still appears on the page.

Many Thanks.

 

November 6, 2007
7:35 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

What's your URL

Right, disabled means not active, it doesn't hide it. Short answer you can't. Long answer: you can go into the code and add any number of hidden fields you like to the ones that already exist (see cforms.php bottom).

November 6, 2007
5:44 pm
Tom
Guest

Okay thanks.  Good to know.  I think I may have found a work around for what I was trying to do. 

The test site is: http://gambertshirts.com/wordpress/

But it's a work in progress with only a couple form items.

Another question I have is that on this form, I'm going to have the visitors submit their information, the information goes first to a confirmation page that will act as the final "submit" page sending the information to the database.

Right now, I have a little for loop that cycles through the form data and displays it on the confirmation page and then ebeds the previsouly entered information as form elements.

$be_var = $_POST;

foreach ( $be_var as $key => $value ) {
    //take out hidden data
    if(strstr($key,'field')){
        print("<p><Strong>'$key': </strong> $value\\n</p>\\n");
        print("<input type='hidden' name='$key' value='$value'/>\\n");
     } else {
        print("<input type='hidden' name='$key' value='$value'/>\\n");
    }
}

 

 The output looks like (where "Test" and "M" were values entered on the form):

‘cf3_field_1′: test

‘cf3_field_2′: M

Is there a way to display automatically the labels on a confirmation page so that ‘cf3_field_1′ becomes First Name as it is on the form page?

If not, I can declare each variable individually but since the form will eventually be quite long, it would be nice to display the information on the confirmation page automatically. 

 

November 6, 2007
7:40 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

Not sure I understand why you'd want to make it a multi-step submission process, but here is what I would do (for a two step process):

  1. Start with two forms (default + one extra)
  2. first form on the first page is designed in cforms using the admin UI
  3. first forms Redirect form data feature points to second page
  4. The custom page template of the Second page contains your above loop and feeds the collected data into a cforms array used for creating a custom, dynamic form (form #2)
  5. Form #2 is build at run time and based on the input of form #1
  6. When submitted form #2 finally sends off the data

Note: Form #1 can only support non-ajax submission method, while Form #2 can do both!

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: 3757

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5355

Posts: 18732

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

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

Administrators: Oliver (6400), Nicky (3)