Forums

value in dynamic dropdown menu do not register into db

bucefaloopus 10 Jan, 2011
hi alls, i'm a dummy chronoforms user, i've a problem within dynamic dropdown menu in a form:
i populate the dropdown with values bring from another table of db, the selection function fine BUT... when i saved form into db the value do not registered
sorry but i do not out from here, pls help me.
tks for coop
g.
this is the code that i find in this forum
<div class="form_item">
  <div class="form_element cf_dropdown">
   <label class="cf_label" style="width: 150px;">Select Person</label>
    <select class="cf_inputbox validate-selection" id="cf_user_id" size="1" title=""  name="cf_user_id">
    <option value="">Choose Employee</option>
    <?php
    $db =& JFactory::getDBO();
    $query = "
      SELECT *
        FROM #__chronoforms_capo_area ";
    $db->setQuery($query);
    $rows = $db->loadObjectList();



foreach ($rows as $row) {
echo "<option value='".$row->id."'>".$row->cognome_procacciatore."</option>";

}
    ?>
    </select>
    </div>
</div>
GreyHead 11 Jan, 2011
Hi ctdesign87,

The code here looks OK. Do you have a cf_user_id column in your table (usually ChronoForms adds one and uses it for the current user id).

Bob
bucefaloopus 11 Jan, 2011
hi bob, in advance thanks a lot for your attention and sorry for my bad english but good italinglish ;-)
well, in my db table cf_user_id for every record is equal to zero, but change in the same table my cf_id (sequential progressive number), well even i change in my query cf_id insteand cf_user_id the result don't change; in my form in the dropdown menu when i choose my choice the message is: can't be empty!
i saw the correct value but in the db table this value is not stored!
tks
giovanni
GreyHead 11 Jan, 2011
Hi bucefaloopus ,

Without seeing the form it's hard to tell exactly what is happening.

You should not try to save new values in cf_id - that will break the table if it works at all.

The value of 0 in cf_user_id is normal if the form is being submitted by a guest; if it is being submitted by a logged in user then it should show their Joomla! User ID.

But, if you have a cf_user_id input in your form it should over-ride the 'normal' setting and this isn't happening for some reason.

I'd suggest that you rename the input to something else like 'user_id', add an extra column to the table and then refresh the DB Connection (see below). That way you'll record both values.

Bob

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.
This topic is locked and no more replies can be posted.