Help with forms

General discussions related to php

Moderators: egami, macek, gesf

Post Reply

Mon Feb 17, 2003 5:55 pm

I have two forms. One is for a summary on one page and needs to have a MAXLENGTH of 75. I have the form working, but, I need it to wrap text, or allow returns in the text to start a new line. basically I need it to work like my second script, but with the MAXLENGTH like my first. Any suggestions?

<FORM NAME="summary" ACTION="web/spences_summary.php" METHOD="POST">
<B>Spences Corner Summary:
(75 characters max)</B><br>
<INPUT TYPE=TEXT NAME="spences_summary" MAXLENGTH=75><BR>
<P><INPUT TYPE="submit" VALUE="submit">

<FORM NAME="message" ACTION="web/spences_message.php" METHOD="POST">
<B>Spences Corner Message:</B><br>
<TEXTAREA NAME="spences_message" ROWS=5 COLS=40></TEXTAREA>
<INPUT TYPE="submit" VALUE="Update">

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Tue Feb 18, 2003 3:42 am

I think the only way you'd get maxlength working on a textarea is to javascript the submit event with a field check

<input type="submit" onclick="(document.forms['message'].elements['spences_message'].length<75)?document.forms['message'].submit:alert('drat too long'); return false" value="click me" />

flytyped == untested
avatar image based upon nasas apod (only updates if I post though)

New php-forum User
New php-forum User
Posts: 36
Joined: Tue Jan 07, 2003 8:45 am
Location: Minnesota, USA

Tue Feb 18, 2003 4:02 pm

Man, I really hope that someday plain vanilla HTML will give us either a textArea with a maxlength property, or a text input with a multiline option. Having 2 choices for basic text entry, and nothing that has the best of both, is a pain in the tookus.

Post Reply