kpcollier Posted April 10, 2023 Report Share Posted April 10, 2023 On my submission form, I have an input field of the Number datatype. I am trying to prevent users from entering in negative numbers. Data validation like this should be standard for a Cloud Database solution, but I guess it isn't. I've tried using the forum post below, which works with preventing the negative numbers, but makes my Calculated Value stop working. The calc value is as follows (cbParamVirtual10 is receiving a number value on load): CASE WHEN [@field:Stock_CartItems_Table_Quantity] > [@cbParamVirtual10] THEN "<div id='warningBox'> Not enough on hand to satisfy your order.<br>All or part of your order may be back-ordered. </div><hr style='border-color:#cfcfcf;'/> " ELSE "" END When the input field is greater than cbParamVirtual10, I need to show that div message. If not, show nothing. It seems the problem with this is that Caspio just uses a general <input> element for all datatypes for some reason. It will not be <input type="number"> for a Number field. When setting the input element as type="number" via the forum script, this calculated value stops working and never shows the message. As an added bonus, we also like the up/down arrows on the element to increment/dec the value that accompanies this number input type. I need to find a way to prevent negative numbers in the input field while also having my calculated value show the message when the condition is met. Any ideas? Quote Link to comment Share on other sites More sharing options...
kpcollier Posted April 10, 2023 Author Report Share Posted April 10, 2023 I've also tried manipulating the calculated value formula, wrapping the values in CONVERT. Didn't seem to do the trick either. CASE WHEN CONVERT(INT,[@field:Stock_CartItems_Table_Quantity]) > CONVERT(INT,[@cbParamVirtual10]) THEN "<div id='warningBox'> Not enough on hand to satisfy your order.<br>All or part of your order may be back-ordered. </div><hr style='border-color:#cfcfcf;'/> " ELSE "" END and CASE WHEN CONVERT(INT,[@field:Stock_CartItems_Table_Quantity] > [@cbParamVirtual10]) THEN "<div id='warningBox'> Not enough on hand to satisfy your order.<br>All or part of your order may be back-ordered. </div><hr style='border-color:#cfcfcf;'/> " ELSE "" END Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.