Welcome Guest, Not a member yet? Register   Sign In
How to make column filled not empty while warning show up
#1

Hello.

For example, i have  20 filed that user must filled  all (name, address, gender,...   etc ).
But the problem is, if user already type in 19 field, if he forgot to type in 1 field, while he click button SAVE, the warning is show up that " The bla bla bla field is required "   all 19 filled field come to empty again.  How to prevent this ?

My view for example is this :

<div class="form-group">
<label>Name</label>
<input type="text" name="name" class="form-control" placeholder="Input ur name">
<?php echo form_error('name'); ?>
</div>
          <div class="form-group">
<label>Telepon</label>
<input type="text" name="telepon" class="form-control" placeholder="Input ur telepon  ..">
<?php echo form_error('telepon'); ?>
</div>


I used not json or javascript in my CI,, only PHP as usual in insert, update database
Reply
#2

Go to the doc's Form helper section and take a look at set_value().
Reply
#3

Yups,,thanks for your help,  yes i added  value="<?php echo set_value('alamat_rumah' ); ?>" 

Before: 
<div class="form-group">
<label>Alamat</label>
<input type="text" name="alamat_rumah" class="form-control" placeholder="Masukkan alamat..">
<?php echo form_error('alamat_rumah'); ?>
</div>

After :
<div class="form-group">
<label>Alamat</label>
<input type="text" name="alamat_rumah" value="<?php echo set_value('alamat_rumah' ); ?>" class="form-control" placeholder="Masukkan alamat..">
<?php echo form_error('alamat_rumah'); ?>
</div>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB