lengleng Posted June 2, 2021 Report Share Posted June 2, 2021 I'm checking to see how to force a field to only accept numbers and put up and down arrows, as well. Caspio only seems to have Text Field, and while setting DataType to number makes the submission display an error, I still want to restrict it and put arrows so there won't be any mistake happening the first time. Something like this Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted June 2, 2021 Report Share Posted June 2, 2021 Yeah that's possible with JavaScript, just use the code below. It basically just changes the field's input type to number instead of the default Text. This only works for Submission Form, you may check out the Id of the fields here: <script> document.getElementById('InsertRecordFIELDNAME').type='number'; </script> Quote Link to comment Share on other sites More sharing options...
LWSChad Posted June 4, 2021 Report Share Posted June 4, 2021 To expand to all forms document.querySelector('[name*=Recordfield_name]').type = 'number'; Caspio names inputs according to the following syntax. Submission forms: <input type="text" name="InsertRecordfield_name" id="InsertRecordfield_name_includes_textstring_if_cascading" value="" class="cbFormTextField"> Edit and detail forms: <input type="text" name="EditRecordfield_name" id="EditRecordfield_name_includes_textstring_if_cascading" value="" class="cbFormTextField"> Virtual fields in all forms: <input type="text" name="cbParamVirtual2" id="cbParamVirtual2_includes_textstring_if_cascading" value="" class="cbFormTextField"> The code above for changing to a number field works because [name*=Recordfield_name] will target both InsertRecord and EditRecord inputs then change the type from "text" to "number" 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.