The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
Newbie question concerning math and error checking - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Newbie question concerning math and error checking (/showthread.php?tid=5252) |
Newbie question concerning math and error checking - smoring - Jul 27th, 2015 New to the product and not sure where to look in the documentation. Wanting to allow input of two fields that must equal 100. Imagine it's a percentage that must be 100% and you'll understand where I'm going with this. So, my end-user would enter something like 50/50 or 75/25 where the two would add up to 100. What's the best approach to doing this? RE: Newbie question concerning math and error checking - alexh - Jul 27th, 2015 I would look at some jQuery examples that do the math for verification. You could probably even have it calculate the second percentage based on the first percentage field. RE: Newbie question concerning math and error checking - smoring - Jul 27th, 2015 (Jul 27th, 2015, 12:57 PM)alexh Wrote: I would look at some jQuery examples that do the math for verification. You could probably even have it calculate the second percentage based on the first percentage field. Thank you for the speedy reply. Is this something that I'd find in the forums or is there another sample code location? RE: Newbie question concerning math and error checking - alexh - Jul 27th, 2015 Probably not in the forums here, but if you google "jQuery form field validation", or maybe "jQuery form field validation percentages", you will probably come up with some existing code. When I have a moment I'll see if I can find something for you! RE: Newbie question concerning math and error checking - smoring - Jul 27th, 2015 I see, the second google search netted: http://stackoverflow.com/questions/9635703/jquery-validate-dynamic-percentage-field Seems promising. This one seems to cover my problem. http://www.raymondcamden.com/2009/03/26/Using-jQuery-to-validate-the-sum-of-form-fields |