/    Sign up×
Community /Pin to ProfileBookmark

On my web site, people can place a small ad that fits in predefined sized cell in a table. The ad is made up of 16 Max characters at font size 3 for the title and then 6 rows of approximately 31 characters per row for the body. When they submit the 6 rows x 31 char ad, I have a multiline text area set up for them to type into and I have it set so that it wraps at 31 characters and I set the max length to 186 characters.

My question is in two parts.

1) I noticed that the max length is not working. It wraps properly at 31 characters, but I can enter unlimited # of characters. How do I set the max number of characters allowed? I am using Frontpage by the way.

2) I am using the Arial font. I know for something like this Courier or a fixed width font woud work better, but I want to use Arial. If someone enters ad text that contains a lot of capital W’s as opposed to text that contains a lot of lower case i’s, they obviously cannot enter as many characters. Is there a way to calculate a non-fixed width font to determine if an ad would fit in the allowed cell size? I do not want to make my cell sizes resizable. I want all cell sizes to to be the same.

I guess if I get #1 solved, I won’t have to worry about #2, but I would still like to know how to do this.

Thanks,
Joe

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJun 12.2006 — The maxlength attribute does not apply to textareas, only to text-type input elements. If you want to use a textarea, then you'll have to add your own validation on the server side that validates the number of characters and generates an error if they exceed it. (You could also add local validation with JavaScript, but you need the server-side validation for users who have JS disabled.) Alternatively, you could create one input element for each row, with a maxlength attribute of 31 (or whatever value you want to use).
×

Success!

Help @jgbarber65 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...