Welcome Guest, Not a member yet? Register   Sign In
How to show validation error for multiple text boxes
#1

(This post was last modified: 09-04-2023, 02:37 AM by sknair143.)

Hello,

I have multiple textboxes which is created dynamically when user click on a button called "Add new section". my section code looks like this
PHP Code:
<div id="secAsset">
                                <div class="mb-3 col-md-6">
                                    <label for="assetType" class="form-label">Asset Type</label>
                                    <input class="form-control" type="text" id="assetType" name="assetType[]"
                                        placeholder="Mobile Phone" value="" autofocus />
                                </div>


                                <div class="mb-3 col-md-6">
                                    <label for="assetRemark" class="form-label">Remarks</label>
                                    <input class="form-control" type="text" id="assetRemark" name="assetRemark[]"
                                        placeholder="Enter any remarks including ref no," value="" autofocus />
                                </div>
                            </div

I have model called AssetsModel.php and there i have added rule required to both fields (type and remarks). But when the validation fails how i can display the error message for each field ?

can you give me an idea ?
Reply
#2

It's in the manual:
https://codeigniter.com/user_guide/libra...n#the-form
Reply




Theme © iAndrew 2016 - Forum software by © MyBB