Jump to content

Restrict field with to only accept Numbers and have arrows

Recommended Posts

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 

Link to comment
Share on other sites

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: 






Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...