It looks like you're new here. If you want to get involved, click one of these buttons!
$this->load->library('form_builder', array('text_size_limit' => '20', 'submit_value' => 'Update', 'form_attrs' => array('action' => site_url('Update'), 'method' => 'post'), 'show_required' => FALSE));
$form_1 = $this->form_builder->render_divs();
$this->load->library('form_builder', array('text_size_limit' => '20', 'submit_value' => 'Convert', 'form_attrs' => array('action' => site_url('Convert'), 'method' => 'post'), 'show_required' => FALSE));
$form_2 = $this->form_builder->render_divs();
// Then I use this in the same view.
<div>
<?php echo $form_1; ?>
</div>
<div>
<?php echo $form_2; ?>
</div>
Comments
Have your tried setting the public param like:
# after second load
$this->form_builder->submit_value = 'Convert';
$this->form_builder->render_divs();
Appears to be what set_params() is doing anyway.
Your solution is working like a charm! Thank you very much!
I will try this again with 1.0.
$this->load->library('form_builder'); $this->form_builder->initialize(array('text_size_limit' => '20', 'submit_value' => 'Update', 'form_attrs' => array('action' => site_url('Update'), 'method' => 'post'), 'show_required' => FALSE)); $form_1 = $this->form_builder->render_divs(); $this->form_builder->initialize(array('text_size_limit' => '20', 'submit_value' => 'Convert', 'form_attrs' => array('action' => site_url('Convert'), 'method' => 'post'), 'show_required' => FALSE)); $form_2 = $this->form_builder->render_divs(); // Then I use this in the same view. <div> <?php echo $form_1; ?> </div> <div> <?php echo $form_2; ?> </div>
I observed that if one of the form does not pass the validation, it will display error in both forms.
In this case, what is the best way to display the error in the correct form?
Thank you very much.
$this->load->library('form_builder'); $this->load->library('validator'); $this->form_builder->initialize(array('text_size_limit' => '20', 'submit_value' => 'Update', 'form_attrs' => array('action' => site_url('Update'), 'method' => 'post'), 'show_required' => FALSE)); $form_1 = $this->form_builder->render_divs(); $this->form_builder->initialize(array('text_size_limit' => '20', 'submit_value' => 'Convert', 'form_attrs' => array('action' => site_url('Convert'), 'method' => 'post'), 'show_required' => FALSE)); $validator2 = new Validator(); $this->form_builder->set_validator($validator2); $form_2 = $this->form_builder->render_divs(); // Then I use this in the same view. <div> <?php echo $form_1; ?> </div> <div> <?php echo $form_2; ?> </div>