[eluser]pegas[/eluser]
Hy , here's one for you :
I have a controller in wich I place some variables from my model and then i render the view in which I make a form using form_open(I've used the method without using codeigniter to) and a foreach to generate some checkboxes.
then i have a javascript that "listenes" to what i check and gives me as feedbak(for the moment) a simple alert message.
The problem is that with generating the form this way my javascript returns nothing( it should return the name of the checked element for example) .
If the same form with de same name and same action( and etc) is made on brute HTML without using loops or php or codeigniter however , everything works just fine.
So this is my problem.
The asset helper is loaded , the form helper is loader , the code does not have errors.
Help me please.
Here is some code:
the function:
Code:
function get_check_value(){
var c_value = "";
for (var i=0; i < document.promoForm.promo.length; i++)
{
if (document.promoForm.promo[i].checked)
{
c_value = c_value + document.promoForm.promo[i].value + "\n";
}
}
alert(c_value);
}
the view :
Code:
<html>
<head>
<?php echo css_asset('tabcontent.css')?>
<?php echo js_asset('tabcontent.js')?>
<?php echo js_asset("outils.js") ?>
<title>Gestion du personnel(promo) a revoir</title>
</head>
<body>
<h2>Gestion de promotions </h2>
<?php echo form_open('',$atributes)?>
<?php echo '' ;
foreach($promos as $id=>$value)
echo $value.form_checkbox("promo", $value,true)."<br />" ;
?>
<input type="button" id="creer_onglets" name="creer_onglets" value="Gerer">
<?php echo form_close() ;?>
<!-- modified the name so the javascript works with the other form -->
<form name="promoForm_TEST">
<input type="checkbox" name="promo" value="X" checked="checked" />
<input type="checkbox" name="promo" value="Y" checked="checked" />
<input type="checkbox" name="promo" value="rze" checked="checked" />
<input type="button" id="creer_onglets" name="creer_onglets" value="Gerer">
</form>
</body>
</html>
a part of he controller :
Code:
$this->load->helper('asset');
$this->load->helper('form');
$data['atributes'] = array('name'=>'promoForm');
$data['promos'] = $this->M->getTsPromos($dept);
$this->load->view('vue_gestionPerso',$data);