2

One field in our website's sign-up form is occasionally left blank yet we need it to include one sentence that for legal reasons must not be editable. This is then later used as part of the user's profile and will sit in the same place if they added content to that field too during the initial sign-up.

How can we populate this single field with an uneditable/undeletable sentence, yet allow text to be added above it if the user chooses to?

Currently the field in question looks like this:

<textarea name="description" id="eBann" rows="2" maxlength="1500" cols="20" onKeyUp="toCount('eBann','sBann','{CHAR} characters left',1500);"><?php echo $description;?></textarea>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
JoeW
  • 578
  • 1
  • 10
  • 29

2 Answers2

2

Why don't you just use the input for the optional extras and put the uneditable part in the HTML directly below it? For the prompt use something like: "Here's our sentence, if you want to add your own comment, enter it here." In the form processing script, just concatenate it with the static sentence.

Kevin
  • 53,822
  • 15
  • 101
  • 132
0

Any HTML form can be changed by the user (even if it says readonly). The only way to do this safely is either server-side when they submit the form, or server-side when you get and output the information.

EDIT:

With dual languages (I'm assuming human language, not programming!), you'll definitely want to output the string with the rest of the information, and never store it in a database. That'll help you in case you ever want to change what the string is, and also will allow localisation for different languages.

you786
  • 3,659
  • 5
  • 48
  • 74
  • Thanks, yes, trouble is... we have a dual-language website using table data from the same database. I'll have a think... – JoeW Aug 30 '11 at 21:36
  • Human languages, yes! Thanks again. We've opted for a very dull and simple solution. I was hoping for something more elegant, I'll work on it. – JoeW Aug 30 '11 at 22:26