Jump to content

Javascript to limit the text field input

Recommended Posts

Hello everybody,

I have a field in the datapage that accepts upto 2 characters. i want to limit the input entered to <=25. Any idea how do i do that. I know i have to write some kinda javascript.

Here's the datapage:


Field name is Total no. of students taught each day:

the user input should not exceed 25.

Please help.. :(

Link to comment
Share on other sites


If I have understood your question correctly, before submitting the form, you want to check whether the field has value less than 25 or not.

You are right that you need a JavaScript for this.

a hint:

var student = getElementById("InsertRecordfieldname");

var student_num = parsefloat(student.value);


alert("Student number cant be more than 25");

There is another possible solution for this. If it is possible to have a range instead of exact number, you can have a range dropdown for this.

So you can have custom values:

Display Value

0-5 5

5-10 10




Link to comment
Share on other sites

  • 9 years later...

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...