Click to See Complete Forum and Search --> : How do I limit the size on Form Input?


trptscott
12-07-2002, 01:51 PM
I'm constructing a course evaluation for a local university. At this time, I'm utilizing the standard HTML Form process (i.e. mailto:emailaddy) to collect the data.

I have a series of multiple choice answers with assigned values (i.e. 1 - 5). I'm just using a standard TEXTBox for the students to enter their answer.

Is there anyway I can limit the amount of data they can enter in each textbox? And is there anyway I can restrict the data within a certain array (i.e. 1, 2, 3, 4, or 5)?

Any help is greatly appreciated.

MikeOS
12-07-2002, 04:24 PM
With regards to the input text box you only need to add the maxlength attribute to limit the number of characters the user can enter, like so:

<input type="text" name="whatever" maxlength="20">

So here the user can only enter a maximum of 20 characters, the textbox won't allow any more than that.

I don't really understand your second problem, maybe you could explain it a little bit more.

trptscott
12-07-2002, 05:56 PM
Thanks to one and all for replying to my post.

I've got the maxlength inserted throughout the evaluation. However, I can't seem to get the JavaScript portion to work.


Do I place it in the <HEAD> section?

I have a total of 17 questions that are scored 1-5. Do I need 17 sets of script (i.e. one for each fieldname?)

Thanks again for your help.