Forums

fields not stored in database

bzzz 25 Oct, 2010
good evening
with the precious help of greyhead(thank you so much)i made a form with chronoforms containing textarea fields and 4 dropdown lists and a submit button but the pb is that when i validate my form two of the 4 dropdown lists were not stored in the database i don't know why?can you help me please here is the code(html+javascript)
<?php
if ( !$mainframe->isSite() ) { return; }
$db =& JFactory::getDBO();
$query = "
    SELECT *
        FROM `pays`
        ORDER BY `idpays`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<fieldset style="border: 3px double #333399">
  <legend>Pays et ville de résidence</legend>
<label>Pays: </label>
  <select name="pays" id="pays">

    <option value="">- - - Choisissez un pays - - -</option>
<?php
/* Construction de la première liste : on se sert du tableau PHP */
foreach($data as $d) {
  echo "<option value='".$d->idpays."'>".$d->nompays."</option>";
}
?>
  </select>
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande -->
  <span id="blocvilles"></span><br />
  <label for="ville"><?php echo JText::_( 'Ville' ); ?>:</label>
<?php 
echo "<span id='AjaxgetVille';style='color:black'>".JText::_('Choisissez un pays SVP' )."</span>
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span>";
?>
</fieldset>




<?php
if ( !$mainframe->isSite() ) { return; }
$db =& JFactory::getDBO();
$query = "
    SELECT *
        FROM `paysor`
        ORDER BY `idpaysor`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<fieldset style="border: 3px double #333399">
  <legend>Pays et ville d'origine</legend>
<label>Pays: </label>
  <select name="paysor" id="paysor" >

    <option value="">- - - Choisissez un pays - - -</option>
<?php
/* Construction de la première liste : on se sert du tableau PHP */
foreach($data as $d) {
  echo "<option value='".$d->idpaysor."'>".$d->nompaysor."</option>";
}
?>
  </select>
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande -->
  <span id="blocvilles2"></span><br />
  <label for="villeor"><?php echo JText::_( 'Ville' ); ?>:</label>
<?php 
echo "<span id='AjaxgetVilleor';style='color:black'>".JText::_('Choisissez un pays SVP' )."</span>
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span>";
?>
</fieldset>
<br>
<input type="submit" name="ok" id="ok" value="Envoyer" />

here is the javascript code
window.addEvent('domready', function() {
  $('pays').addEvent('change', function () {
    var a = $('pays').value;
    if ( a != null && a != '' ) {
      getVille(a);
    } else {
      $('AjaxgetVille').setHTML("<span id='AjaxgetVille';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});

function getVille(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVille'), 
    data: 'idpays='+a
  }).request();
};




window.addEvent('domready', function() {
  $('paysor').addEvent('change', function () {
    var a = $('paysor').value;
    if ( a != null && a != '' ) {
      getVilleor(a);
    } else {
      $('AjaxgetVilleor').setHTML("<span id='AjaxgetVilleor';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});

function getVilleor(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&extraid=2&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVilleor'), 
    data: 'idpaysor='+a
  }).request();
};

here is extracode1
<?php
$idpays =& JRequest::getString('idpays', '', 'get');
if ( $idpays ) {
  $db =& JFactory::getDBO();
  $query1 = "
    SELECT `idville`, `nomville`
      FROM `ville`
      WHERE `idpays` = '$idpays' ;
  ";
  $db->setQuery($query1);
  $data1 = $db->loadObjectList();
}
//$return = '<div>$data1: '.print_r($data1, true).'</div>';
if ( count($data1) ) {
  $m1 = new stdClass();
  $m1->idville = 0;
  $m1->nomville = '==?==';
  $data1 = array_merge(array($m1), $data1);
  //$return = '<div>$data1: '.print_r($data1, true).'</div>';

  $return  = JHTML::_('select.genericlist', $data1, 'Ville','class="inputbox required select" size="1" ', 'idville', 'nomville',  0); 
} 
else {
  $return = JText::_('Pays introuvable');
}
echo $return;
?>



and finally extracode2
<?php
$idpaysor =& JRequest::getString('idpaysor', '', 'get');
if ( $idpaysor ) {
  $db =& JFactory::getDBO();
  $query2 = "
    SELECT `idvilleor`, `nomvilleor`
      FROM `villeor`
      WHERE `idpaysor` = '$idpaysor' ;
  ";
  $db->setQuery($query2);
  $data2 = $db->loadObjectList();
}
//$return = '<div>$data2: '.print_r($data2, true).'</div>';
if ( count($data2) ) {
  $m2 = new stdClass();
  $m2->idvilleor = 0;
  $m2->nomvilleor = '==?==';
  $data2 = array_merge(array($m2), $data2);
  //$return = '<div>$data2: '.print_r($data2, true).'</div>';
  $return  = JHTML::_('select.genericlist', $data2, 'Villeor', 'class="inputbox required select" size="1" ', 'idvilleor', 'nomvilleor',  0); 
} else {
  $return = JText::_('Pays introuvable');
}
echo $return;
?>

thank you and excuse me if it is too long
GreyHead 25 Oct, 2010
Hi bzzz,

Which fields aren't stored? Are there columns with these names in the database table?

Bob
bzzz 25 Oct, 2010
idville and idvilleor are the fields that i could not store in the database.
i have created 4 tables pays ville paysor and villeor, ville and villeor contain three fields idville(idvilleor) idpays(idpaysor) is a foreign key from table pays(paysor) and the last one is nomville(nomvilleor).
thank you
GreyHead 25 Oct, 2010
Hi bzzz,

If you turn DeBug on what results are in the $_POST array?

Bob
bzzz 25 Oct, 2010
i frankly don't know where should i find the $_post variable(is it in console,html,script or dom section?)but here is what i receive when i validate my form:

Form passed first SPAM check OK
Form passed the submissions limit (if enabled) OK
Form passed the Image verification (if enabled) OK
Form passed the server side validation (if enabled) OK
$_POST Array: Array ( [pays] => DE [Ville] => Lz [paysor] => BD [Villeor] => MWA [ok] => Envoyer [f09e0571bf535238db0cbd502a725d8e] => 1 [1cf1] => 759d0cf63ebb924bfa4224f57fe30991 [chronoformname] => test_form_94 )
$_FILES Array: Array ( )
Form passed the plugins step (if enabled) OK
Debug End
GreyHead 26 Oct, 2010
Hi bzzz,

It's here
$_POST Array: Array ( [pays] => DE [Ville] => Lz [paysor] => BD [Villeor] => MWA [ok] => Envoyer [f09e0571bf535238db0cbd502a725d8e] => 1 [1cf1] => 759d0cf63ebb924bfa4224f57fe30991 [chronoformname] => test_form_94
in the code you posted. As you can see neither the idville or the idvilleor are included.

Please now do View Source on your form when both of those dropdowns are displayed and copy the Form HTML for that part here.

Bob
bzzz 26 Oct, 2010
Good morning everybody
here is the code
<form name="ChronoContact_test_form_94" id="ChronoContact_test_form_94" method="post" action="http://127.0.0.1/site1/index.php?option=com_chronocontact&task=send&chronoformname=test_form_94" > 
		
				<fieldset style="border: 3px double #333399"> 
  <legend>Pays et ville de résidence</legend> 
<label>Pays: </label> 
  <select name="pays" id="pays"> 
 
    <option value="">- - - Choisissez un pays - - -</option> 
<option value='BE'>Belgique
</option><option value='DE'>Allemagne
</option><option value='DK'>Danemark
</option><option value='ES'>Espagne
</option><option value='FI'>Finlande
</option><option value='FR'>France
</option><option value='GB'>Royaume-Uni
</option><option value='GR'>Grèce</option><option value='IT'>Italie
</option><option value='NL'>Pays-Bas
</option><option value='PT'>Portugal
</option><option value='SE'>Suède</option><option value='SI'>Suisse</option>  </select> 
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande --> 
  <span id="blocvilles"></span><br /> 
  <label for="ville">Ville:</label> 
<span id='AjaxgetVille';style='color:black'>Choisissez un pays SVP</span> 
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span></fieldset> 
 
 
 
 
<fieldset style="border: 3px double #333399"> 
  <legend>Pays et ville d'origine</legend> 
<label>Pays: </label> 
  <select name="paysor" id="paysor" > 
 
    <option value="">- - - Choisissez un pays - - -</option> 
<option value='AL'>Algérie</option><option value='BD'>Burundi
</option><option value='BK'>Burkina Faso
</option><option value='BN'>Bénin</option><option value='CM'>Cameroun
</option><option value='CO'>Comores
</option><option value='DJ'>Djibouti
</option><option value='GAB'>Gabon
</option><option value='LB'>Liban
</option><option value='MA'>Maroc
</option><option value='ML'>Mali
</option><option value='NG'>Niger
</option><option value='SG'>Sénégal</option><option value='TU'>Tunisie</option>  </select> 
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande --> 
  <span id="blocvilles2"></span><br /> 
  <label for="villeor">Ville:</label> 
<span id='AjaxgetVilleor';style='color:black'>Choisissez un pays SVP</span> 
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span></fieldset> 
<br> 
<input type="submit" name="ok" id="ok" value="Envoyer" /> 
 
 
		<input type="hidden" name="f50429da8193dc71ff3068d887e7c5b8" value="1" />	
                	<input type="hidden" name="1cf1" value="e101ce87b239fc026b3d0f9de2f793d6" /> 
                </form>
GreyHead 26 Oct, 2010
Hi bzzz,

The selects with ids idville and idvilleor aren't show in that code. Do they exist in the page?

Bob
bzzz 26 Oct, 2010
yes they do,when i made a selection of a "pays" the select of "ville" appears by calling the javascript code
window.addEvent('domready', function() {
  $('pays').addEvent('change', function () {
    var a = $('pays').value;
    if ( a != null && a != '' ) {
      getVille(a);
    } else {
      $('AjaxgetVille').setHTML("<span id='AjaxgetVille';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});

function getVille(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVille'), 
    data: 'idpays='+a
  }).request();
};
and extracode1 shown below
<?php
$idpays =& JRequest::getString('idpays', '', 'get');
if ( $idpays ) {
  $db =& JFactory::getDBO();
  $query1 = "
    SELECT `idville`, `nomville`
      FROM `ville`
      WHERE `idpays` = '$idpays' ;
  ";
  $db->setQuery($query1);
  $data1 = $db->loadObjectList();
}
//$return = '<div>$data1: '.print_r($data1, true).'</div>';
if ( count($data1) ) {
  $m1 = new stdClass();
  $m1->idville = 0;
  $m1->nomville = '==?==';
  $data1 = array_merge(array($m1), $data1);
  //$return = '<div>$data1: '.print_r($data1, true).'</div>';

  $return  = JHTML::_('select.genericlist', $data1, 'Ville','class="inputbox required select" size="1" ', 'idville', 'nomville',  0); 
} 
else {
  $return = JText::_('Pays introuvable');
}
echo $return;
?>
GreyHead 26 Oct, 2010
Hi bzz,

I understand what the code is supposed to do. But do thay actually show up in the browser? If they do that you should be able to see them in the page source and the results should be included in the $_POST array.

Bob
bzzz 26 Oct, 2010
they show up only after i made a select of value of "pays" otherwise there is only the text"choisissez..." here is attached a capture of the form.
thank you
GreyHead 26 Oct, 2010
Hi bzzz,

Yes exactly. Now please select a pays and then look at the page source with the drop-downs displayed.

Bob
bzzz 26 Oct, 2010
here is the code source when i select "pays" and "paysor"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-fr" lang="fr-fr" > 
<head> 
  <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
  <meta name="robots" content="index, follow" /> 
  <meta name="keywords" content="joomla, Joomla" /> 
  <meta name="description" content="Joomla! - le portail dynamique et système de gestion de contenu" /> 
  <meta name="generator" content="Joomla! 1.5 - Open Source Content Management" /> 
  <title>site1</title> 
  <link href="/site1/templates/pantheon/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
  <script type="text/javascript" src="/site1/media/system/js/mootools.js"></script> 
  <style type="text/css"> 
			span.cf_alert {
				background:#FFD5D5 url(http://127.0.0.1/site1/components/com_chronocontact/css/images/alert.png) no-repeat scroll 10px 50%;
				border:1px solid #FFACAD;
				color:#CF3738;
				display:block;
				margin:15px 0pt;
				padding:8px 10px 8px 36px;
			}
		</style>	
		
				
                <script type='text/javascript'> 
//<![CDATA[
window.addEvent('domready', function() {
  $('pays').addEvent('change', function () {
    var a = $('pays').value;
    if ( a != null && a != '' ) {
      getVille(a);
    } else {
      $('AjaxgetVille').setHTML("<span id='AjaxgetVille';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});
 
function getVille(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVille'), 
    data: 'idpays='+a
  }).request();
};
 
 
 
 
window.addEvent('domready', function() {
  $('paysor').addEvent('change', function () {
    var a = $('paysor').value;
    if ( a != null && a != '' ) {
      getVilleor(a);
    } else {
      $('AjaxgetVilleor').setHTML("<span id='AjaxgetVilleor';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});
 
function getVilleor(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&extraid=2&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVilleor'), 
    data: 'idpaysor='+a
  }).request();
};//]]>
</script> 
 
 
 
 
 
 
<meta http-equiv="Content-Type" content="text/html; <br />
<b>Notice</b>:  Use of undefined constant _ISO - assumed '_ISO' in <b>F:\Program Files\EasyPHP5.2.10\www\site1\templates\pantheon\index.php</b> on line <b>226</b><br />
_ISO" /> 
<meta http-equiv="Content-Style-Type" content="text/css" /> 
 
<link rel="stylesheet" href="http://127.0.0.1/site1/templates/system/css/system.css" type="text/css" /> 
<link rel="stylesheet" href="http://127.0.0.1/site1/templates/system/css/general.css" type="text/css" /> 
 
<link href="http://127.0.0.1/site1/templates/pantheon/css/template.css" rel="stylesheet" type="text/css" media="screen" /> 
 
<link href="http://127.0.0.1/site1/templates/pantheon/css/s5_suckerfish.css" rel="stylesheet" type="text/css" media="screen" /> 
 
<link href="http://127.0.0.1/site1/templates/pantheon/css/editor.css" rel="stylesheet" type="text/css" media="screen" /> 
 
 
<link href="http://127.0.0.1/site1/templates/pantheon/css/multibox/multibox.css" rel="stylesheet" type="text/css" media="screen" /> 
<link href="http://127.0.0.1/site1/templates/pantheon/css/multibox/ajax.css" rel="stylesheet" type="text/css" media="screen" /> 
<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/multibox/overlay.js"></script> 
<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/multibox/multibox.js"></script> 
<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/multibox/AC_RunActiveContent.js"></script> 
 
 
<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/jquery13.js"></script> 
<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/jquery_no_conflict.js"></script> 
<script type="text/javascript"> 
var s5_fading_menu = "no";
function s5_jqmainmenu(){
jQuery(" #navlist ul ").css({display: "none"}); // Opera Fix
jQuery(" #s5_navv li").hover(function(){
		jQuery(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){jQuery(this).find('ul:first').css({visibility: "hidden"});	});}
  jQuery(document).ready(function(){ s5_jqmainmenu();});
</script> 
 
<script language="javascript" type="text/javascript" >var s5_text_menu_1 = 'Return Home';</script><script language="javascript" type="text/javascript" >var s5_text_menu_2 = 'Menu Effects';</script><script language="javascript" type="text/javascript" >var s5_text_menu_3 = 'Whats Included';</script><script language="javascript" type="text/javascript" >var s5_text_menu_4 = 'Language Support';</script><script language="javascript" type="text/javascript" >var s5_text_menu_5 = 'Default J!';</script><script language="javascript" type="text/javascript" >var s5_text_menu_6 = 'Get Help';</script><script language="javascript" type="text/javascript" >var s5_text_menu_7 = '';</script><script language="javascript" type="text/javascript" >var s5_text_menu_8 = '';</script><script language="javascript" type="text/javascript" >var s5_text_menu_9 = '';</script><script language="javascript" type="text/javascript" >var s5_text_menu_10 = '';</script> 
<link href="http://127.0.0.1/site1/templates/pantheon/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
 
 
<style type="text/css"> 
 
#s5_outer_wrap, #s5_top_menu_inner2, #s5_header_wrap2 {
width:950px;
margin-left:auto;
margin-right:auto;
}
 
.s5_h3_first, #s5_register, #s5_login, #s5_navv li.active .s5_outer_active a, #s5_navv ul li ul li a:hover, a, .contentpagetitle, .contentheading, .module_round_box .menu #current a, .s5_transparent_box .menu #current a, h2, h4 {
color:#47D9DE;
}
 
 
 
</style> 
 
</head> 
 
<body id="s5_body" style="background-color:#000000"> 
 
<div style="display:none"> 
	<img src="http://127.0.0.1/site1/templates/pantheon/images/s5_menu_sub_li_hover.png" alt=""></img> 
</div> 
 
	<div id="s5_body_wrap" style="background:url('http://127.0.0.1/site1/templates/pantheon/images/s5_background1.jpg') no-repeat top center; position:fixed"> 
	</div> 
 
	<div id="s5_main_body_wrap"> 
		<div id="s5_top_menu"> 
					</div> 
		<div class="s5_shadow1"></div> 
		<div id="s5_header_wrap1"> 
			<div id="s5_header_wrap2"> 
				<div id="s5_logo" onclick="window.document.location.href='http://127.0.0.1/site1/'"></div> 
								<div style="clear:both; height:0px"></div> 
			</div>	
		</div> 
		<div class="s5_shadow2"></div> 
		<div id="s5_outer_wrap"> 
			
						
			<div class="s5_wrap_tl"> 
				<div class="s5_wrap_tr"> 
					<div class="s5_wrap_tm"> 
					</div> 
				</div> 
			</div> 
			<div class="s5_wrap_ml"> 
				<div class="s5_wrap_mr"> 
					<div class="s5_wrap_mm"> 
						<div class="s5_wrap_inner_content"> 
						
															<div id="s5_menu_search_wrap"> 
								
									
										<div id="s5_navv"> 
															
											<ul> 
	<li><span class="s5_outer_active"><span class="s5_rs"><a class="active" href="/site1/">Acceuil<span class="s5_bottom_text"></span></a></span></span></li> 
	<li><span class="s5_outer_active"><span class="s5_rs"><a class="active" href="/site1/index.php?option=com_content&view=section&id=3&Itemid=41">FAQ<span class="s5_bottom_text"></span></a></span></span></li> 
	<li><span class="s5_outer_active"><span class="s5_rs"><a class="active" href="/site1/index.php?option=com_weblinks&view=categories&Itemid=48">Liens Utiles<span class="s5_bottom_text"></span></a></span></span></li> 
	<li><span class="s5_outer_active"><span class="s5_rs"><a class="active" href="/site1/index.php?option=com_chronocontact&Itemid=61">Enregistrement<span class="s5_bottom_text"></span></a></span></span></li> 
	<li><span class="s5_outer_active"><span class="s5_rs"><a class="active" href="/site1/index.php?option=com_wrapper&view=wrapper&Itemid=62">test<span class="s5_bottom_text"></span></a></span></span></li> 
</ul>											
												
											
											<script type="text/javascript" src="http://127.0.0.1/site1/templates/pantheon/js/s5_menu_active_and_parent_links.js"></script>																		
										</div> 
														
																		
									<div id="s5_search_login_wrap"> 
										<div id="s5_search"> 
											
											<div style="clear:both; height:0px"></div> 
										</div> 
									
										<div id="s5_login_register_wrap"> 
																																</div> 
									
									</div> 
									
									<div style="clear:both; height:0px"></div> 
								</div> 
															
																	
																<div id="s5_main_body_wrap2"> 
									<div id="s5_main_body_wrap2_inner"> 
										<div id="s5_main_body_wrap_inner2">	
											<div id="s5_main_content_wrap"> 
												<div id="s5_main_content_wrap_inner" style="margin-right:0px;margin-left:200px"> 
													<div id="s5_component_wrap"> 
														<div id="s5_body_wrap2"> 
														
																														
																															<div id="s5_component_wrap_area"> 
																	<div id="s5_component_wrap_area_inner"> 
																		
																				
																			<div id="s5_pathway_wrap"> 
																			<div id="s5_pathway_wrap_inner1"> 
																			<div id="s5_pathway_wrap_inner2"> 
																			<div id="s5_pathway_wrap_inner3"> 
																				
																																									<div id="s5_pathway"> 
																								<div class="moduletable"> 
			<span class="breadcrumbs pathway"> 
Home</span> 
		</div> 
	
																					</div> 
																																								
																				<div style="clear:both; height:0px"></div> 
																				
																			</div> 
																			</div> 
																			</div> 
																			</div> 
																		
																																			
																		<div class="s5_transparent_box_tl"> 
																			<div class="s5_transparent_box_tr"> 
																				<div class="s5_transparent_box_tm"> 
																				</div> 
																			</div> 
																		</div> 
																		
																		<div class="s5_transparent_box_ml"> 
																			<div class="s5_transparent_box_mr"> 
																				<div class="s5_transparent_box_mm"> 
																																											<div style="height:38px"></div> 
																																										
																							                						        <form name="ChronoContact_test_form_94" id="ChronoContact_test_form_94" method="post" action="http://127.0.0.1/site1/index.php?option=com_chronocontact&task=send&chronoformname=test_form_94" > 
		
				<fieldset style="border: 3px double #333399"> 
  <legend>Pays et ville de résidence</legend> 
<label>Pays: </label> 
  <select name="pays" id="pays"> 
 
    <option value="">- - - Choisissez un pays - - -</option> 
<option value='BE'>Belgique
</option><option value='DE'>Allemagne
</option><option value='DK'>Danemark
</option><option value='ES'>Espagne
</option><option value='FI'>Finlande
</option><option value='FR'>France
</option><option value='GB'>Royaume-Uni
</option><option value='GR'>Grèce</option><option value='IT'>Italie
</option><option value='NL'>Pays-Bas
</option><option value='PT'>Portugal
</option><option value='SE'>Suède</option><option value='SI'>Suisse</option>  </select> 
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande --> 
  <span id="blocvilles"></span><br /> 
  <label for="ville">Ville:</label> 
<span id='AjaxgetVille';style='color:black'>Choisissez un pays SVP</span> 
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span></fieldset> 
 
 
 
 
<fieldset style="border: 3px double #333399"> 
  <legend>Pays et ville d'origine</legend> 
<label>Pays: </label> 
  <select name="paysor" id="paysor" > 
 
    <option value="">- - - Choisissez un pays - - -</option> 
<option value='AL'>Algérie</option><option value='BD'>Burundi
</option><option value='BK'>Burkina Faso
</option><option value='BN'>Bénin</option><option value='CM'>Cameroun
</option><option value='CO'>Comores
</option><option value='DJ'>Djibouti
</option><option value='GAB'>Gabon
</option><option value='LB'>Liban
</option><option value='MA'>Maroc
</option><option value='ML'>Mali
</option><option value='NG'>Niger
</option><option value='SG'>Sénégal</option><option value='TU'>Tunisie</option>  </select> 
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande --> 
  <span id="blocvilles2"></span><br /> 
  <label for="villeor">Ville:</label> 
<span id='AjaxgetVilleor';style='color:black'>Choisissez un pays SVP</span> 
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span></fieldset> 
<br> 
<input type="submit" name="ok" id="ok" value="Envoyer" /> 
 
 
		<input type="hidden" name="ead6908c6390cf6e43a32523808a1c6f" value="1" />	
                	<input type="hidden" name="1cf1" value="7254b161bb4176df2efb54e9fd8d9f58" /> 
                </form> 
 
<!-- don't remove the following 3 lines if you didn't buy a subscription --> 
<div class="chronoform"> 
<a href="http://www.chronoengine.com">Powered By ChronoForms - ChronoEngine.com</a> 
 
</div> 
<!-- don't remove the 3 lines above if you didn't buy a subscription -->	
 
		
																				</div> 
																			</div> 
																		</div> 
																		
																		<div class="s5_transparent_box_bl"> 
																			<div class="s5_transparent_box_br"> 
																				<div class="s5_transparent_box_bm"> 
																				</div> 
																			</div> 
																		</div> 
																		
																		<div class="s5_small_shadow"></div> 
																	</div> 
																</div> 
																														
																														
														</div> 
													</div> 
												</div> 
											</div> 
												
																							<div id="s5_left_wrap" style="width:200px"> 
														
					
						
				
		<div class="s5_transparent_box"> 
		
						<div class="s5_mod_transparent_h3_outer"> 
				<div class="s5_mod_transparent_h3_1"> 
				<div class="s5_mod_transparent_h3_2"> 
					<h3 class="s5_mod_h3"><span class="s5_h3_first">Menu </span> principal</h3> 
				</div> 
				</div> 
			</div> 
					
			<div class="s5_transparent_box_tl"> 
				<div class="s5_transparent_box_tr"> 
					<div class="s5_transparent_box_tm"> 
					</div> 
				</div> 
			</div> 
			
			<div class="s5_transparent_box_ml"> 
				<div class="s5_transparent_box_mr"> 
					<div class="s5_transparent_box_mm"> 
													<div style="height:40px"></div> 
												<ul class="menu"><li class="item1"><a href="http://127.0.0.1/site1/"><span>Acceuil</span></a></li><li class="item41"><a href="/site1/index.php?option=com_content&view=section&id=3&Itemid=41"><span>FAQ</span></a></li><li class="item48"><a href="/site1/index.php?option=com_weblinks&view=categories&Itemid=48"><span>Liens Utiles</span></a></li><li class="item61"><a href="/site1/index.php?option=com_chronocontact&Itemid=61"><span>Enregistrement</span></a></li><li class="item62"><a href="/site1/index.php?option=com_wrapper&view=wrapper&Itemid=62"><span>test</span></a></li></ul>						<div style="clear:both; height:0px"></div> 
					</div> 
				</div> 
			</div> 
			
			<div class="s5_transparent_box_bl"> 
				<div class="s5_transparent_box_br"> 
					<div class="s5_transparent_box_bm"> 
					</div> 
				</div> 
			</div> 
			
			<div class="s5_small_shadow"></div> 
		
		</div> 
 
	
												</div> 
																						
																					
											<div style="clear:both; height:0px"></div> 
										</div> 
									</div> 
								</div> 
																
								<div style="clear:both; height:0px"></div> 
						
														</div> 
					</div> 
				</div> 
			</div> 
			<div class="s5_wrap_bl"> 
				<div class="s5_wrap_br"> 
					<div class="s5_wrap_bm"> 
					</div> 
				</div> 
			</div> 
			
			<div class="s5_shadow2"></div> 
			
			
						
			<div class="s5_wrap_tl"> 
				<div class="s5_wrap_tr"> 
					<div class="s5_wrap_tm"> 
					</div> 
				</div> 
			</div> 
			<div class="s5_wrap_ml"> 
				<div class="s5_wrap_mr"> 
					<div class="s5_wrap_mm"> 
						<div id="s5_footer_wrap"> 
							<div id="s5_footer_text"> 
								<span class="footerc"> 
Copyright © 2010.  site1.
Designed by <a href="http://www.shape5.com/" class="footerc" title="Visit Shape5.com" target="blank">Shape5.com</a> 
</span> 
							</div> 
														<div style="clear:both; height:0px"></div> 
						</div> 
					</div> 
				</div> 
			</div> 
			<div class="s5_wrap_bl"> 
				<div class="s5_wrap_br"> 
					<div class="s5_wrap_bm"> 
					</div> 
				</div> 
			</div> 
			
			<div class="s5_shadow2" style="height:30px"></div> 
					
		</div> 
		
		
		
	</div> 
	
		
	<div style="display:none"> 
					<img src="http://127.0.0.1/site1/templates/pantheon/images/s5_background2.jpg" alt=""></img> 
			<script type="text/javascript" language="javascript"> 
				var s5_bg_tween = "7";
				var s5_bg_images = "3";
				var s5_bg_img_1 = "http://127.0.0.1/site1/templates/pantheon/images/s5_background1.jpg";
				var s5_bg_img_2 = "http://127.0.0.1/site1/templates/pantheon/images/s5_background2.jpg";
			</script> 
							<img src="http://127.0.0.1/site1/templates/pantheon/images/s5_background3.jpg" alt=""></img> 
			<script type="text/javascript" language="javascript"> 
				var s5_bg_img_3 = "http://127.0.0.1/site1/templates/pantheon/images/s5_background3.jpg";
			</script> 
									</div> 
	<script type="text/javascript" language="javascript" src="http://127.0.0.1/site1/templates/pantheon/js/s5_effects.js"></script> 
		
		
			<script type="text/javascript" language="javascript" src="http://127.0.0.1/site1/templates/pantheon/js/s5_textmenu.js"></script> 
		
		<script type="text/javascript"> 
		var s5mbox = {};
		window.addEvent('domready', function(){	s5mbox = new MultiBox('s5mb', {descClassName: 's5_multibox', useOverlay: true, showControls: true});	});
	</script> 
		
 
</body> 
 
</html>

and a capture
GreyHead 26 Oct, 2010
Hi bzzz,

Well . . . the drop-downs are in the image but not in the page source code :-(

I'm not sure what is happening here.

Bob
bzzz 26 Oct, 2010
can it be a problem of template?because when i used another template(i tried two) and made a select of "pays" the second dropdown didn't show up,here is captures.
thank you
GreyHead 26 Oct, 2010
Hi bzzz,

If in doubt test with ja_purity; or add &tmpl=component to the form url and test without a template.

Bob
bzzz 26 Oct, 2010
same problem,ville and villeor are not stored 😢
bzzz 26 Oct, 2010
could it be a detail in the structure of ville and villeor tables:?:
GreyHead 27 Oct, 2010
Hi bzzz,

The immediate problem is that the form isn't returning any values for idville or idvilleor so they can't be stored.

Bob
bzzz 29 Oct, 2010
hi Bob
i'm back with something that may help.
i noticed that when i test only the dropdrown(without including them in a form),the second list(ville or villeor) doesn't show up(please take a look at capture.jpg)but when i include the dropdown lists in a form the second lists show up!😲 (capture1.jpg)
thank you
bzzz 29 Oct, 2010
...something strange again:
when i replaced in the extracode this line
$m->nomville = '==?==';

by this one
$m->nomville = '--choisir une ville--';
and reload the form,i still get ==?== instead of --choisir une ville-- !!!😲
here is capture
i'm trying to be useful thank you Bob
GreyHead 30 Oct, 2010
Hi bzzz,

I'm not sure that I can add any thing useful here without actually seeing the form or the source code including the drop-downs.

Bob
bzzz 30 Oct, 2010
i couldn't upload the backupform because the extension cfbak is not allowed so here is the form code divided in four parts:
1)the form html
<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 180px;">Email:*</label>
    <input class="cf_inputbox required validate-email" maxlength="150" size="30" title="" id="text_0" name="text_email" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_password">
    <label class="cf_label" style="width: 180px;">Mot De Passe:*</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_1" name="text_mdp" type="password" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_password">
    <label class="cf_label" style="width: 180px;">Vérification Mot De Passe:*</label>
    <input class="cf_inputbox required" maxlength="150" size="30" title="" id="text_2" name="text_vmdp" type="password" />
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">les champs signalés par une astérisque (*) sont obligatoires.</span> </div>
  <div class="cfclear"> </div>
</div>

<?php
if ( !$mainframe->isSite() ) { return; }
$db =& JFactory::getDBO();
$query = "
    SELECT *
        FROM `pays`
        ORDER BY `nompays`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<fieldset style="border: 3px double #333399">
  <legend>Pays et ville de résidence</legend>
<label>Pays: </label>
  <select name="pays" id="pays">

    <option value="">- - - Choisissez un pays - - -</option>
<?php
/* Construction de la première liste : on se sert du tableau PHP */
foreach($data as $d) {
  echo "<option value='".$d->idpays."'>".$d->nompays."</option>";
}
?>
  </select>
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande -->
  <span id="blocvilles"></span><br />
  <label for="ville"><?php echo JText::_( 'Ville' ); ?>:</label>
<?php 
echo "<span id='AjaxgetVille';style='color:black'>".JText::_('Choisissez un pays SVP' )."</span>
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span>";
?>
</fieldset>




<?php
if ( !$mainframe->isSite() ) { return; }
$db =& JFactory::getDBO();
$query = "
    SELECT *
        FROM `paysor`
        ORDER BY `nompaysor`;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<fieldset style="border: 3px double #333399">
  <legend>Pays et ville d'origine</legend>
<label>Pays: </label>
  <select name="paysor" id="paysor" >

    <option value="">- - - Choisissez un pays - - -</option>
<?php
/* Construction de la première liste : on se sert du tableau PHP */
foreach($data as $d) {
  echo "<option value='".$d->idpaysor."'>".$d->nompaysor."</option>";
}
?>
  </select>
<!-- ICI, le secret : on met un bloc avec un id ou va s'insérer le code de
         la seconde liste déroulande -->
  <span id="blocvilles2"></span><br />
  <label for="villeor"><?php echo JText::_( 'Ville' ); ?>:</label>
<?php 
echo "<span id='AjaxgetVilleor';style='color:black'>".JText::_('Choisissez un pays SVP' )."</span>
<span id='progress_gV' style='visibility:hidden;' > Recherche . . .</span>";
?>
</fieldset>
<br>
<input type="submit" name="ok" id="ok" value="Envoyer" />


2) the form javascript
window.addEvent('domready', function() {
  $('pays').addEvent('change', function () {
    var a = $('pays').value;
    if ( a != null && a != '' ) {
      getVille(a);
    } else {
      $('AjaxgetVille').setHTML("<span id='AjaxgetVille';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});

function getVille(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVille'), 
    data: 'idpays='+a
  }).request();
};




window.addEvent('domready', function() {
  $('paysor').addEvent('change', function () {
    var a = $('paysor').value;
    if ( a != null && a != '' ) {
      getVilleor(a);
    } else {
      $('AjaxgetVilleor').setHTML("<span id='AjaxgetVilleor';style='color:black' >Choisissez un pays SVP</span>")
    }
  }) ;
});

function getVilleor(a){
  var url = "index.php?option=com_chronocontact&chronoformname=test_form_94&task=extra&extraid=2&format=raw";
  new Ajax(url, {
    method: 'get',
    onRequest: function(){
      $('progress_gV').setStyle('visibility', 'visible');
    },
    onComplete: function(){
      $('progress_gV').setStyle('visibility', 'hidden');
    },
    update: $('AjaxgetVilleor'), 
    data: 'idpaysor='+a
  }).request();
};


the extra code1:
<?php
$idpays =& JRequest::getString('idpays', '', 'get');
if ( $idpays ) {
  $db =& JFactory::getDBO();
  $query = "
    SELECT `idville`, `nomville`
      FROM `ville`
      WHERE `idpays` = '$idpays' ;
  ";
  $db->setQuery($query);
  $data = $db->loadObjectList();
}
//$return = '<div>$data: '.print_r($data, true).'</div>';
if ( count($data) ) {
  $m = new stdClass();
  $m->idville = 0;
  $m->nomville = '--choisir une ville--';
  $data = array_merge(array($m), $data);
  //$return = '<div>$data: '.print_r($data, true).'</div>';
  $return  = JHTML::_('select.genericlist', $data, 'Ville', 'class="inputbox required select" size="1" ', 'idville', 'nomville',  0); 
} else {
  $return = JText::_('Pays introuvable');
}
echo $return;
?>



the extra code2:
<?php
$idpaysor =& JRequest::getString('idpaysor', '', 'get');
if ( $idpaysor ) {
  $db =& JFactory::getDBO();
  $query = "
    SELECT `idvilleor`, `nomvilleor`
      FROM `villeor`
      WHERE `idpaysor` = '$idpaysor' ;
  ";
  $db->setQuery($query);
  $data = $db->loadObjectList();
}
//$return = '<div>$data: '.print_r($data, true).'</div>';
if ( count($data) ) {
  $m = new stdClass();
  $m->idvilleor = 0;
  $m->nomvilleor = '--choisir une ville--';
  $data = array_merge(array($m), $data);
  //$return = '<div>$data: '.print_r($data, true).'</div>';
  $return  = JHTML::_('select.genericlist', $data, 'Villeor', 'class="inputbox required select" size="1" ', 'idvilleor', 'nomvilleor',  0); 
} else {
  $return = JText::_('Pays introuvable');
}
echo $return;
?>

thank you very much for your patience i'm sorry if i bug you,tell me if there is anything else i can do😶 😶 😶
GreyHead 30 Oct, 2010
Hi bzzz,

You can zip a .cfbak file and upload it (or rename it to a .txt file).

Bob
bzzz 30 Oct, 2010
you're right!!!i'm sorry oh how can i be mindless😶
GreyHead 31 Oct, 2010
Hi bzzz,

The Ville drop down is named Ville, not idville so there is no value of idville to save.
<span ;style="color:black" id="AjaxgetVille">   
  <select size="1" class="inputbox required select" id="Ville" name="Ville">
    <option selected="selected" value="0">==?==</option>
    <option value="Be">Berlin</option>
    <option value="Hm">Hambourg</option>
    <option value="MU">Munich</option>
    <option value="Cl">Cologne</option>
    <option value="Br">Brême</option>
    <option value="FR">Francfort</option>
    <option value="Es">Essen</option>
  </select>
</span>

Bob
bzzz 31 Oct, 2010
Thank you Bob but i didn't understand what you mean because although the pays drop down is also named pays the value stored in the table is idpays
i would be much grateful if you help me more can you tell me what should i do to solve the problem😶
thank's again
GreyHead 01 Nov, 2010
Hi bzzz,

ChronoForms uses the matches the input name to the column name from the table when it saves the data. It will not save input from 'pays' to 'idpays' unless there is some code to change one to the other.

I'm afraid that what you need to do is to debug your code carefully. This isn't a ChronoForms problem, it's a problem with inconsistent variable names.

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