Forums

Form with CB data

SPABO 17 Feb, 2012
I drives me crazy, I have a form whioch nicely retrieves data from CommBuilder
When I create a table, it showes the CB fields, eg cb_lidcode, cb_phone etc
On SAVE, no errors
But if I look in the table I cannot see teh CB Fields!!!
Also in "dataview" those fields don't show
The form code is "custom
It starts with
<?php
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$query = "SELECT * FROM `j17_comprofiler` WHERE `id` = ".$user->id."; ";
$db->setQuery($query);
$user_info = $db->loadObject();
?>


This is the code of one of the CB Fields
<div class="ccms_form_element cfdiv_text" id="lidcode_container_div"><label for="lidcode">Lidcode*</label>
<input name="cb_lidcode" type="text" id="cb_lidcode" size="25" maxlength="150" VALUE="<?php $user = &JFactory::getUser();echo $user_info->cb_lidcode;?>" disabled="disabled"  </div>
<input name="cb_lidcode" type="hidden" id="cb_lidcode" VALUE="<?php $user = &JFactory::getUser();echo $user_info->cb_lidcode;?>" </div>
<div class="clear"></div>
GreyHead 18 Feb, 2012
Hi SPABO,

Where are you putting this code? Is it all in the Form HTML box?

You have two inputs with the same name one of which is disabled. Disabled inputs don't return any value when the form is submitted; it maybe that this is 'erasing' the value from the hidden input.

Bob

PS The $user =&JFactory::getUser() doesn't need to be repeated - and it isn't doing anything here anyhow so you may as well remove it.
SPABO 18 Feb, 2012
Hi Bob
Both codes are in the HTML box ( custom-code)

Not sure what I did, but apperently I had two codes with the sname id ! 😶

On teh other hand, I don't think you can update the table when you add a new field in the form

Can you confirm?
SPABO 18 Feb, 2012
As I thought, when you add a new field in an excisting form, you cannnot simply update the corresponding table!
You have to create a new table, and this new table to be attached to the form again
But than you have to change the validation settings where the tablename is requiered
Last but not least, the tidy up the database, you have to delete the old table (via phpMyAdmin)

In otherwords : Maybe to look at this (updating table with newly added formfields)??

Pls you thoughts on this
GreyHead 18 Feb, 2012
Hi SPABO,

There is no need to delete and recreate the table.

In CFv4 re-save the form.

In CFv3 you need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.

Bob
SPABO 24 Feb, 2012
As it does in CFv4 Bob !
tx
This topic is locked and no more replies can be posted.