• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error message not showing for radio button

#1
In my view page, I have created a radio button for gender selection. but all my input fields errors are showing in red color except the radio button error, it is showing in normal black font color. Can anyone help with this?

This is my view page:

Code:
    <div class="form-group">
    <label for="name">First Name</label>
    <input type="text" name="fname" id="fname" value="<?php echo set_value('fname')?>" class="form-control <?php echo (form_error('fname') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your First Name">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('fname'));?></p>
   
    </div>
    <div class="form-group">
    <label for="name">Last Name</label>
    <input type="text" name="lname" id="lname" value="<?php echo set_value('lname')?>" class="form-control <?php echo (form_error('lname') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Last Name">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('lname'));?></p>
    </div>
    <div class="form-group">
    <label for="email">Email</label>
    <input type="text" name="email" id="email" value="<?php echo set_value('email')?>" class="form-control <?php echo (form_error('email') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Email">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('email'));?></p>
    </div>
    <div class="form-group">
    <label for="password">Password</label>
    <input type="password" name="password" id="password" value="<?php echo set_value('password')?>" class="form-control <?php echo (form_error('password') !="")? 'is-invalid':'' ;?>" placeholder="Enter Password">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('password'));?></p>
    </div>
        <div class="form-group">
            <label for="conf_password">Confirm Password</label>
            <input type="password" name="conf_password" id="conf_password" value="<?php echo set_value('conf_password')?>" class="form-control <?php echo (form_error('conf_password') !="")? 'is-invalid':'' ;?>" placeholder="Confirm Password">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('conf_password'));?></p>
        </div>
        <div class="form-group" class="radio">
        <?php echo form_label('Gender','gender');?><br>
          <?php echo form_error('gender'); ?>         
            <input type="radio" name="gender" id="optionsRadio1" value="male" <?php echo set_radio('gender','male');?>>&nbsp;Male
            <input type="radio" name="gender" id="optionsRadio2" value="female" <?php echo set_radio('gender','female');?>>&nbsp;Female
           
        </div>
    <div class="form-group">
    <label for="mobile">Mobile</label>
    <input type="text" name="mobile" id="mobile" value="<?php echo set_value('mobile')?>" class="form-control <?php echo (form_error('mobile') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Mobile No.">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('mobile'));?></p>
    </div>
    <div class="form-group">
    <button class="btn btn-block btn-primary">REGISTER</button>
    </div>
Reply

#2
(08-08-2020, 12:17 AM)skghosh Wrote: In my view page, I have created a radio button for gender selection. but all my input fields errors are showing in red color except the radio button error, it is showing in normal black font color. Can anyone help with this?

This is my view page:

Code:
    <div class="form-group">
    <label for="name">First Name</label>
    <input type="text" name="fname" id="fname" value="<?php echo set_value('fname')?>" class="form-control <?php echo (form_error('fname') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your First Name">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('fname'));?></p>
   
    </div>
    <div class="form-group">
    <label for="name">Last Name</label>
    <input type="text" name="lname" id="lname" value="<?php echo set_value('lname')?>" class="form-control <?php echo (form_error('lname') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Last Name">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('lname'));?></p>
    </div>
    <div class="form-group">
    <label for="email">Email</label>
    <input type="text" name="email" id="email" value="<?php echo set_value('email')?>" class="form-control <?php echo (form_error('email') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Email">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('email'));?></p>
    </div>
    <div class="form-group">
    <label for="password">Password</label>
    <input type="password" name="password" id="password" value="<?php echo set_value('password')?>" class="form-control <?php echo (form_error('password') !="")? 'is-invalid':'' ;?>" placeholder="Enter Password">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('password'));?></p>
    </div>
        <div class="form-group">
            <label for="conf_password">Confirm Password</label>
            <input type="password" name="conf_password" id="conf_password" value="<?php echo set_value('conf_password')?>" class="form-control <?php echo (form_error('conf_password') !="")? 'is-invalid':'' ;?>" placeholder="Confirm Password">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('conf_password'));?></p>
        </div>
        <div class="form-group" class="radio">
        <?php echo form_label('Gender','gender');?><br>
          <?php echo form_error('gender'); ?>         
            <input type="radio" name="gender" id="optionsRadio1" value="male" <?php echo set_radio('gender','male');?>>&nbsp;Male
            <input type="radio" name="gender" id="optionsRadio2" value="female" <?php echo set_radio('gender','female');?>>&nbsp;Female
           
        </div>
    <div class="form-group">
    <label for="mobile">Mobile</label>
    <input type="text" name="mobile" id="mobile" value="<?php echo set_value('mobile')?>" class="form-control <?php echo (form_error('mobile') !="")? 'is-invalid':'' ;?>" placeholder="Enter Your Mobile No.">
            <p class="invalid-feedback"><?php echo strip_tags(form_error('mobile'));?></p>
    </div>
    <div class="form-group">
    <button class="btn btn-block btn-primary">REGISTER</button>
    </div>

In all fields prior to the gender field you are displaying "is-invalid" if there is an error in the respective field. The same is not done for the gender field. There is not even a parent div in the display of:
Code:
<?php echo form_error('gender'); ?>
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.