Adding new fields to an existing form

jvince 24 Jul, 2009
Hi,
I have a couple of forms that are working fine, but I need to add a few hidden fields to each for tracking purpouses.

Do I just add the HTML for the hidden fields from within the form code tab/screen?
How will CF be able to save the data from these new fields into it's DB table?

Many thanks,

- Vince
GreyHead 24 Jul, 2009
Hi Vince,

Just add them to the Form HTML in the Form Code tab. Provided that the field names match column names in the database table ChronoForms will save the data OK (the names must match exactly).

Bob
jvince 27 Jul, 2009
Hi Bob,
These hidden fields are new, and do not exist in the current DB.

Hence similar to when we create a new form with CF and it creates all the necessary fields, but this time we are adding new to an existing form. I was wondering if that was the purpous for the 'update SQL' button?

At worst, would I have to create a totally new form with the extra fields, and delete the old form?
Only problem with that is the previous data would not be in the new form for stats.

Thanks,

- Vince
GreyHead 27 Jul, 2009
Hi Vince,

Add the new columns to the database table and it will work OK.

The 'Update SQL' link is to upgrade the ChronoForms tables when there is a change after an extension upgrade. No use to you here.

Bob
jvince 27 Jul, 2009
OK, understood.
So now I've created the new fields, all that remains is to populate them :-)

Problem is, that the code I need to use to populate the hidden fields has this:

<form method="POST" name='contactform' onSubmit="populateHiddenFields(this);"> 


The key part being
onSubmit="populateHiddenFields(this);"

I have attempted to add this in various places near the end of the form code, but no dice.
This is the end code I have right now.
<td></td><td><input name="submit" value="Submit" type="submit"></td>


Any ideas?
Many thanks,

- Vince
GreyHead 27 Jul, 2009
Hi Vince,

Put the snippet in the Form Tag Attachment box on the Form General Tab - ChronoForms will then put it in the Form tag.

Bob
jvince 28 Jul, 2009
Bob,
You're the man!

I didn't even notice that option in CF.
Worked perfect.
Thank you again, very much.

- Vince
Checkmate 12 Aug, 2009
Add the new columns to the database table and it will work OK.

How do you do that? Can it be done in Chronoforms?
Checkmate 12 Aug, 2009
I added the field to the html code. Then added the field to the table using phpmyadmin. then added it to my email code.

just fyi.
This topic is locked and no more replies can be posted.