Form Validation - One number less than another - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Form Validation - One number less than another (/showthread.php?tid=29953) |
Form Validation - One number less than another - El Forum - 04-27-2010 [eluser]richzilla[/eluser] Hi All, is there anyway to validate the following scenario in the form_validation library. Basically, i have a stock form, where the quantity of stock is entered. Another field enables users to reserve a quantity of that stock, so that it doesn't appear available in the db. Obviously the amount reserved has to be less than the total amount in stock. How would i go about validating that? Any help would be appreciated. Form Validation - One number less than another - El Forum - 04-27-2010 [eluser]WanWizard[/eluser] I have extended the form validation library, and added these methods to compare two posted values: Code: // -------------------------------------------------------------------- Don't forget to add the appropriate language strings: Code: $lang['matches_value'] = 'The value of the field %s must be equal to %s.'; Form Validation - One number less than another - El Forum - 04-27-2010 [eluser]richzilla[/eluser] Spot on. Thanks for the help. Form Validation - One number less than another - El Forum - 04-27-2010 [eluser]WanWizard[/eluser] Small update, I posted an old version of the code (and forgot the language strings). |