Forum Moderators: open
I was wondering if anyone could help me out with this: Below is part of a form - what I want is for the text box to be "pre-filled" with some text. What do I need to add to acheive this?
I know this is a very newbie question, if anyone could help, I'd really appreciate it - thanks.
<form method='post'>
<input type='hidden' name='action' value='postnewpage' />
<table>
<tr><td valign='top'>$[NewPage]:</td>
<td><textarea name='description' cols='40' rows='8'></textarea>
</td></tr></table>
<div align='center'><input type='submit' value='$[submit new page]' />
</div>
</form>
***********************************************
If you need to see the complete form, here it is:
<form method='post'>
<input type='hidden' name='action' value='postnewpage' />
<table>
<tr><td class='newpagefield'> $[Author]:</td>
<td><input type='text' name='author' value='\$Author' /></td></tr>
<tr><td class='seitenname'>$[Group]:</td>
<td><input type='text' name='group'value='Enter Site Name Here'></td></tr>";
/* <td><select name='group' >" ;
foreach($NewGroup as $k=>$v) {
$x = is_string($k)? $k : $v;
$out[] = "<option value='$x'>$v</option>";
} */
$out [] = "
<tr><td class='gruppe'>$[Pagename]:</td>
<td><input type='text' name='newpagename'></td></tr>";
$out[] = "
<tr><td valign='top'>$[NewPage]:</td>
<td><textarea name='description' cols='40' rows='8' ></textarea>
</td></tr></table>
<div align='center'><input type='submit' value='$[submit new page]' />
</div>
</form>
But that is not working. Is that supposed to work? This is part of a larger php script, so it might be a problem with the script itself. Just thought I'd mention that, in case it helps...
Phil
HTML is not a very consistent form of scripting, and textarea is a good example of how confusing it can get.
I've been coding in raw HTML for 7+ years, and it often catches me out once in a while as well (especially with table formats and backgrounds).
My advice is to keep several examples of the confusing stuff so that you can refer to it again & again when it simply hasn't gelled yet!
<label></label>
<button></button>
<fieldset></fieldset>
<textarea></textarea>
It is only elements requiring no closing tag which have an attribute defining the content:
<img src>
<input value>
<meta content>
:)
What is counter intuitive, however, is that the content can still be accessed in JavaScript using
value. But that is simply a mechanism for keeping consistency with the other input elements I would imagine.