We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Form Validation with SET_CHECKBOX in Update/Edit Form

Development and Programming

fnbhns's avatar
fnbhns
22 posts
11 years ago
fnbhns's avatar fnbhns

Dear All,

I am new in CI, in my asking if anything wrong i appologies at first.

I want to Update/ Edit a Form with Checkbox and Option, At form submit i want to validate these. After validaiton if there is error, i want to have remain my Selected Checkbox CHECKED at Edit Form.

Instead of this the Checkbox is Checking according to the pulling Database Value. I need your kind support for this solution. i used the following code. But if you have your good advices or coding please,

<input type="checkbox" name="M0140" value="1"  <?php echo ($result->M0140== "1" ) ? "checked" : set_checkbox('M0140, '1',$result->M0140== "1"); ?> size="1">

Highly expecting your kind support. Thanking you in advance…….!!

       
fnbhns's avatar
fnbhns
22 posts
11 years ago
fnbhns's avatar fnbhns

Dear friends,

I already got the solution, if anyone needed as below

<input type="checkbox"  name="M0140"  value="0"  <?php echo set_checkbox('M0140, 0,$result->M0140 == "0"); ?>  size="1"> None
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.