Welcome Guest, Not a member yet? Register   Sign In
problem with only the first radiobox value !
#1

[eluser]krislec[/eluser]
All my first radiobox don't return the post value ?

The View :
Code:
<td colspan="2" style="text-align:center;">
          &lt;?php
            echo form_label('Civilité','civilite');
            echo form_radio('civilite','Mr',set_radio('civilite','Mr',set_value('civilite',@$rows->civilite == 'Mr')),'style="margin:0 3px 0 0"');
            echo form_label(' Mr.','Mr',array('style'=>'font-style:normal;width:100px'));
            echo form_radio('civilite','Mme',set_radio('civilite','Mme',set_value('civilite',@$rows->civilite == 'Mme')),'style="margin:0 3px 0 15px"');
            echo form_label(' Mme.','Mme',array('style'=>'font-style:normal;width:100px'));
            echo form_radio('civilite','Mlle',set_radio('civilite','Mlle',set_value('civilite',@$rows->civilite == 'Mlle')),'style="margin:0 3px 0 15px"');
            echo form_label(' Mlle.','Mlle',array('style'=>'font-style:normal;width:100px'))."
";
          ?&gt;

The Controller:
Code:
$this->form_validation->set_rules('civilite','Civilité','trim|required|xss_clean');

I get the same problem if I swap the values, so I think there's no problem with my database...
and I can't fix it.

Any Idea ?
#2

[eluser]InsiteFX[/eluser]
I think you need to read the CodeIgniter User Guide on the Form_Validation Class!

InsiteFX
#3

[eluser]krislec[/eluser]
Ok...
I'm going to read it back !
#4

[eluser]krislec[/eluser]
well... it's done. But i don't understand why it didn't work ?
is this required to have 2 pages for form ? the form and the sucess form ?
the form (to insert) cannot be the form used for the update action ?
that's why I used "set_value"(form new to repopulate) and "$r->civilite" (form update to retrieve data from mysql)

What's wrong ?

And just for comment the excellent user guide, I haven't seen example for how to use set_radiobox, set_checkbox.... with the helper mode writing (form_radio, form_checkbox...)

K. (a french guy)
#5

[eluser]krislec[/eluser]
Nobody ?...
#6

[eluser]krislec[/eluser]
just for help...

Code:
echo form_label('','civilite');
          // Mr
            $mr_checked = set_value('civilite') =='Mr' ? TRUE : @$rows->civilite == 'Mr' ? TRUE : '';
            echo form_radio('civilite','Mr',set_radio('civilite','Mr',$mr_checked),'style="margin:0 3px 0 0"');
            echo form_label(' Mr.','Mr',array('style'=>'font-style:normal;width:100px'));
           // Mme
            $mme_checked = set_value('civilite') =='Mme' ? TRUE : @$rows->civilite == 'Mme' ? TRUE : '';
            echo form_radio('civilite','Mme',set_radio('civilite','Mme',$mme_checked),'style="margin:0 3px 0 15px"');
            echo form_label(' Mme.','Mme',array('style'=>'font-style:normal;width:100px'));
          // Mlle
            $mlle_checked = set_value('civilite') =='Mlle' ? TRUE : @$rows->civilite == 'Mlle' ? TRUE : '';
            echo form_radio('civilite','Mlle',set_radio('civilite','Mlle',$mlle_checked),'style="margin:0 3px 0 15px"');
            echo form_label(' Mlle.','Mlle',array('style'=>'font-style:normal;width:100px'));




Theme © iAndrew 2016 - Forum software by © MyBB