Welcome Guest, Not a member yet? Register   Sign In
IF i use $this->template->write_view, my form helper stops working
#1

[eluser]mrahsanahmad[/eluser]
codeigniter is great but i am having some problem, probably you guys could hellp me out

I am using a template library.. my controller_frontPAge is
function index() {
$this->template->write_view('l​eftPanel','frontPageLogin');
$this->template->render();
}

view_frontPageLogin.php is
<input type="text" name="username" value="<?php echo set_value('username'); ?>" />
<?php echo form_error('username'); ?>
<?php echo form_submit('btnLogin','LOGIN'​); ?>

template is loading fine and FrontPageLogin is also appearing in its required place but when i press LOGIN, username field gets blank wheresas it should have kept the previous value

BUT if i use value="if(isset($POST['usernam​e'])) {echo $POST['username']}"
it remembers the entered value

The problem is if i am to use core PHP to get my tasks, then what is the use of sticking myself to codeIgniter ... I must be going wrong some where. ..

HELP ?
#2

[eluser]OliverHR[/eluser]
Sound weird, I use too the Collin Williams Template library too since CI 1.7.2 and work as espected.
#3

[eluser]pickupman[/eluser]
In order for set_value() to work, you need to create a form validation rule for it.
Code:
//In fronPage controller
$this->load->library('form_validation');

$this->form_validation->set_rules('username', 'username', 'required|trim');

//In view
<?php echo form_input('username', set_value('username'));?>
<?php echo form_error('username');?>
<?php echo form_submit('btnLogin', 'LOGIN');?>




Theme © iAndrew 2016 - Forum software by © MyBB