This is a discussion on Newbie needs help to fix text in a textarea within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi, I'm a newbie needing help to fix imported text in a textarea i.e so that the imported ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I'm a newbie needing help to fix imported text in a textarea i.e so that the imported text in the text area cannot be changed in the webbrowser. Here's the code snippet: <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php include("contracts/termsandconditions.txt"); ?></textarea></p> Thank you in advance, Raj |
|
|||
|
On Mon, 01 Jan 2007 17:43:16 +0100, raj <raj@nospam.com> wrote:
> Hi, > > I'm a newbie needing help to fix imported text in a textarea i.e so that > the > imported text in the text area cannot be changed in the webbrowser. > Here's > the code snippet: > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > include("contracts/termsandconditions.txt"); ?></textarea></p> > > Thank you in advance, > > Raj > Basically you're looking to disable the textarea element. Check out the "disabled" attribute in the html4 specification: http://www.w3.org/TR/html401/interac...#adef-disabled You'd use it like this: <textarea disabled="disabled" ...> But that's only the first step. Although the text can't be edited in the page, there's nothing preventing a malevolent visitor from editing it elsewhere and submitting the changed text to the form handler. Thus in your form handler you also must make sure not to include this textarea. If you need the text, include it in your form handler (a second time, since you already included it in the form) but don't read it from the textarea. Hope this helps! -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
|
|||
|
On Mon, 1 Jan 2007 16:49:52 +0000, OmegaJunior wrote
(in article <op.tlhidevg70mclq@cp139795-a.landg1.lb.home.nl>): > On Mon, 01 Jan 2007 17:43:16 +0100, raj <raj@nospam.com> wrote: > >> Hi, >> >> I'm a newbie needing help to fix imported text in a textarea i.e so that >> the >> imported text in the text area cannot be changed in the webbrowser. >> Here's >> the code snippet: >> >> <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php >> include("contracts/termsandconditions.txt"); ?></textarea></p> >> >> Thank you in advance, >> >> Raj >> > Basically you're looking to disable the textarea element. Check out the > "disabled" attribute in the html4 specification: > http://www.w3.org/TR/html401/interac...#adef-disabled > > You'd use it like this: > <textarea disabled="disabled" ...> > > But that's only the first step. Although the text can't be edited in the > page, there's nothing preventing a malevolent visitor from editing it > elsewhere and submitting the changed text to the form handler. > > Thus in your form handler you also must make sure not to include this > textarea. If you need the text, include it in your form handler (a second > time, since you already included it in the form) but don't read it from > the textarea. > > Hope this helps! > > > Hi, thanks for the help, especially with the form handler bit. You've definately helped. Thank you. Raj :) |
|
|||
|
On Mon, 1 Jan 2007 16:43:16 +0000, raj wrote
(in article <0001HW.C1BEEAA4001125FAB019F94F@news.zen.co.uk> ): > Hi, > > I'm a newbie needing help to fix imported text in a textarea i.e so that the > imported text in the text area cannot be changed in the webbrowser. Here's > the code snippet: > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > include("contracts/termsandconditions.txt"); ?></textarea></p> > > Thank you in advance, > > Raj > a |
|
|||
|
On Mon, 1 Jan 2007 16:43:16 +0000, raj <raj@nospam.com> wrote:
>Hi, > >I'm a newbie needing help to fix imported text in a textarea i.e so that the >imported text in the text area cannot be changed in the webbrowser. Here's >the code snippet: > ><p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php >include("contracts/termsandconditions.txt"); ?></textarea></p> > >Thank you in advance, > >Raj It doesn't make sense to bring this into a textarea. Just bring it into the web page in a div or span or p however if you insist on having this in a text area - you could 'disable' the textarea i found this online somewhere 17.12 Disabled and read-only controls In contexts where user input is either undesirable or irrelevant, it is important to be able to disable a control or render it read-only. For example, one may want to disable a form's submit button until the user has entered some required data. Similarly, an author may want to include a piece of read-only text that must be submitted as a value along with the form. The following sections describe disabled and read-only controls. 17.12.1 Disabled controls Attribute definitions disabled [CI] When set for a form control, this boolean attribute disables the control for user input. When set, the disabled attribute has the following effects on an element: Disabled controls do not receive focus. Disabled controls are skipped in tabbing navigation. Disabled controls cannot be successful. The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA. This attribute is inherited but local declarations override the inherited value. How disabled elements are rendered depends on the user agent. For example, some user agents "gray out" disabled menu items, button labels, etc. In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form. <INPUT disabled name="fred" value="stone"> Note. The only way to modify dynamically the value of the disabled attribute is through a script. 17.12.2 Read-only controls Attribute definitions readonly [CI] When set for a form control, this boolean attribute prohibits changes to the control. The readonly attribute specifies whether the control may be modified by the user. When set, the readonly attribute has the following effects on an element: Read-only elements receive focus but cannot be modified by the user. Read-only elements are included in tabbing navigation. Read-only elements may be successful. The following elements support the readonly attribute: INPUT and TEXTAREA. How read-only elements are rendered depends on the user agent. Note. The only way to modify dynamically the value of the readonly attribute is through a script. |
|
|||
|
On Mon, 1 Jan 2007 16:43:16 +0000, raj wrote
(in article <0001HW.C1BEEAA4001125FAB019F94F@news.zen.co.uk> ): > Hi, > > I'm a newbie needing help to fix imported text in a textarea i.e so that the > imported text in the text area cannot be changed in the webbrowser. Here's > the code snippet: > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > include("contracts/termsandconditions.txt"); ?></textarea></p> > > Thank you in advance, > > Raj > b |
|
|||
|
On Mon, 1 Jan 2007 18:50:54 +0000, Gleep wrote
(in article <crlip2hpo7hrsjckt2qqjdp8ukfj2tap0a@4ax.com>): > On Mon, 1 Jan 2007 16:43:16 +0000, raj <raj@nospam.com> wrote: > >> Hi, >> >> I'm a newbie needing help to fix imported text in a textarea i.e so that >> the >> imported text in the text area cannot be changed in the webbrowser. Here's >> the code snippet: >> >> <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php >> include("contracts/termsandconditions.txt"); ?></textarea></p> >> >> Thank you in advance, >> >> Raj > > > > > It doesn't make sense to bring this into a textarea. Just bring it into the > web page in a div or > span or p > > however if you insist on having this in a text area - you could 'disable' > the textarea > i found this online somewhere > > 17.12 Disabled and read-only controls > In contexts where user input is either undesirable or irrelevant, it is > important to be able to > disable a control or render it read-only. For example, one may want to > disable a form's submit > button until the user has entered some required data. Similarly, an author > may want to include a > piece of read-only text that must be submitted as a value along with the > form. The following > sections describe disabled and read-only controls. > > 17.12.1 Disabled controls > Attribute definitions > > disabled [CI] > When set for a form control, this boolean attribute disables the control for > user input. > When set, the disabled attribute has the following effects on an element: > > Disabled controls do not receive focus. > Disabled controls are skipped in tabbing navigation. > Disabled controls cannot be successful. > The following elements support the disabled attribute: BUTTON, INPUT, > OPTGROUP, OPTION, SELECT, and > TEXTAREA. > > This attribute is inherited but local declarations override the inherited > value. > > How disabled elements are rendered depends on the user agent. For example, > some user agents "gray > out" disabled menu items, button labels, etc. > > In this example, the INPUT element is disabled. Therefore, it cannot receive > user input nor will its > value be submitted with the form. > > <INPUT disabled name="fred" value="stone"> > > > Note. The only way to modify dynamically the value of the disabled attribute > is through a script. > > 17.12.2 Read-only controls > Attribute definitions > > readonly [CI] > When set for a form control, this boolean attribute prohibits changes to the > control. > The readonly attribute specifies whether the control may be modified by the > user. > > When set, the readonly attribute has the following effects on an element: > > Read-only elements receive focus but cannot be modified by the user. > Read-only elements are included in tabbing navigation. > Read-only elements may be successful. > The following elements support the readonly attribute: INPUT and TEXTAREA. > > How read-only elements are rendered depends on the user agent. > > Note. The only way to modify dynamically the value of the readonly attribute > is through a script. > > Thanks Gleep. Much appreciated. Raj |
|
|||
|
<comp.lang.php>
<raj> <Mon, 1 Jan 2007 16:43:16 +0000> <0001HW.C1BEEAA4001125FAB019F94F@news.zen.co.uk> > I'm a newbie needing help to fix imported text in a textarea i.e so that the > imported text in the text area cannot be changed in the webbrowser. Here's > the code snippet: > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > include("contracts/termsandconditions.txt"); ?></textarea></p> > <textarea name="textarea2" disabled cols="70" rows="7"> Will grey the text . <textarea name="textarea2" readonly cols="70" rows="7"> Will display the text as normal . -- www.phptakeaway.co.uk (work in progress) |
|
|||
|
Krustov wrote: > <comp.lang.php> > <raj> > <Mon, 1 Jan 2007 16:43:16 +0000> > <0001HW.C1BEEAA4001125FAB019F94F@news.zen.co.uk> > > > I'm a newbie needing help to fix imported text in a textarea i.e so that the > > imported text in the text area cannot be changed in the webbrowser. Here's > > the code snippet: > > > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > > include("contracts/termsandconditions.txt"); ?></textarea></p> > > > > <textarea name="textarea2" disabled cols="70" rows="7"> > > Will grey the text . > > <textarea name="textarea2" readonly cols="70" rows="7"> > > Will display the text as normal . > > > -- > www.phptakeaway.co.uk > (work in progress) Why put it in a text area if it isn't edittable? You could just display the text in an iframe on a page if you want the scroll bar look, otherwise surely a bordered div would give the same effect, without having to worry about users editing things? You probably have a good reason for doing things this way, but I generally only display form controls if a user can actually interact with them. |
|
|||
|
<comp.lang.php>
<william.clarke> <2 Jan 2007 14:16:55 -0800> <1167776215.468085.66010@a3g2000cwd.googlegroups.c om> > > > I'm a newbie needing help to fix imported text in a textarea i.e so that the > > > imported text in the text area cannot be changed in the webbrowser. Here's > > > the code snippet: > > > > > > <p><textarea name="textarea2" cols="70" rows="7" wrap="virtual"><?php > > > include("contracts/termsandconditions.txt"); ?></textarea></p> > > > > > > > <textarea name="textarea2" disabled cols="70" rows="7"> > > > > Will grey the text . > > > > <textarea name="textarea2" readonly cols="70" rows="7"> > > > > Will display the text as normal . > > > > Why put it in a text area if it isn't edittable? > I was tempted to ask the same thing - but life is too short for that sort of thing and its usually best just to supply the answer :-) -- www.phptakeaway.co.uk (work in progress) |