load a row from a database table after dropdown choice

Trentini 11 May, 2012
Hi,
my name is Sara and i'm a new user here. I use Chronoforms v4 for a short time and I have a problem..
(sorry for my english but I don't speak it very well..I hope to explain the problem in the best way)
I create a data entry form and relative table to save data here I post the code:

<div class="ccms_form_element cfdiv_header" id="autoID-f65eac7559464f1273560644cb0b8ebe_container_div"><h1>Anagrafica Allevatore</h1><div class="clear"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-d8beb1c9c0c94e465bb0b56115e90eda_container_div"><label>RNA</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="rna" />
<div class="small-message">Inserire l'RNA in maiuscolo</div><div class="clear"></div><div id="error-message-rna"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-52d4e7a4b3a4d1d394b482b08796fcdf_container_div"><label>Cognome</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="cognome" />
<div class="clear"></div><div id="error-message-cognome"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-6b52f6ac40cd006e831c8df7c7a84033_container_div"><label>Nome</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="nome" />
<div class="clear"></div><div id="error-message-nome"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-ca81cb57d6a2f0b532ecdedc5f359eb4_container_div"><label>Telefono</label><input maxlength="150" size="30" class=" validate['number']" title="" type="text" value="" name="tel" />
<div class="clear"></div><div id="error-message-tel"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-e68ec4513bc2587bd79ce8487cc04b0b_container_div"><label>Indirizzo</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="indirizzo" />
<div class="clear"></div><div id="error-message-indirizzo"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-de6891a973aa33ac4fbd39da991aa5ff_container_div"><label>CAP</label><input maxlength="150" size="30" class=" validate['number']" title="" type="text" value="" name="cap" />
<div class="clear"></div><div id="error-message-cap"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-3025030b63e1c25a619dfa11b643d361_container_div"><label>Città</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="citta" />
<div class="clear"></div><div id="error-message-citta"></div></div><div class="ccms_form_element cfdiv_text" id="autoID-bb9cb3f3375e6172e78a639a5e3c3fdd_container_div"><label>Associazione</label><input maxlength="150" size="30" class="" title="" type="text" value="" name="associazione" />
<div class="clear"></div><div id="error-message-associazione"></div></div><div class="ccms_form_element cfdiv_submit" id="autoID-6e9f4310e7a2098fb12c12a371f934d5_container_div"><input name="conferma" class="" value="Conferma" type="submit" />
 <input type='reset' name='reset' value='Reset' /><div class="clear"></div><div id="error-message-conferma"></div></div>


After this I can select data by code called RNA with a dropdown; for this I create a form that contains only a dropdown and a submit button (with reset button connected) the code is as follows:

<h1>Scegliere il codice RNA dall'elenco</h1><?php
 
$nome_selected = JRequest::getInt('rna', '', 'post');
$db =& JFactory::getDBO();
 
$query = "
 
SELECT `cf_id`,`rna`, `cognome`,`nome`,`tel`,`indirizzo`,`cap`,`citta`,`associazione`
 FROM `#__chronoforms_data_anagrafica_clienti2`
 ORDER BY `cf_id`
";
$db->setQuery($query);
$nomes = $db->loadAssocList();
$nome_options = "";
foreach ( $nomes as $v ) {
 if ( $nome_selected == $v['rna'] ) {
 $selected = "selected='selected'";
 } else {
 $selected = '';
 }
 
 $nome_options .= "<option value='".$v['cf_id']."' $selected >".$v['rna']."</option>";
 
}
?>


<div>
 <div>
 <label style="width: 250px;">RNA</label>
 <select id="select_1" size="1" title=""  name="scelta_rna">
 <!--<option value="">Choose Option</option>
 <option value="option 1">option 1</option>
 <option value="option 2">option 2</option>
 <option value="option 3">option 3</option> -->
 
 <?php echo $nome_options; ?>
 
 </select>
 
 </div>
 <div> </div>
</div><div class="ccms_form_element" id="input_cont_av">
<a href="index.php?option=com_chronoforms&chronoform=anag_per_iscrizioni&scelta=".$posted['select_rna']"">
<input name="input_avanti" class="" value="Avanti" type="button" />
</a>
<div class="clear"></div></div>


I have not connected the DB to the dropdown using "Action" but with the code inserted at the beginning of the form; to load the data I use another form as the previous one, but how do I connect the form with the dropdown to the next to allow loading data?

This is only a part of a "problem" because I have to create a kind of "management" because I have a table "anagrafica_clienti" and another one "prodotti" and I have to create a third that allows me to combine customer and product
GreyHead 26 May, 2012
Hi Sara,

Sorry for the delay I was away when you posted this message.

The easiest way to pass data between forms is to use the 'Data to Session' and 'Session to Data' actions.

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