Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3943
  • Last Modified:

pre fill input text field of html form

hello,
  I have a simple html form as below:

<form action="page1.php" method="post">
<table>
<td> <input type="text" name="username" size="20" maxlength="40" id="user"><br>
</td>
</table>
<input type="submit" value="login" name="submit">

What should I add to this code so that the input field will be filled up with some text like "username here" when this page is opened.



0
kavishshukla
Asked:
kavishshukla
  • 2
1 Solution
 
gardineCommented:
Hi,

All you have to do is indicate a value like so:

<input type="text" name="username" size="20" maxlength="40" id="user" value="username here">

0
 
RCorfmanCommented:
if the default value is coming from a variable, like a query, or a url, then you should be sure to wrap it in the htmlEditFormat function... and it will need to be inside <cfoutput> tags....

<input type="text" name="username" size="20" maxlength="40" id="user" value=<cfoutput>"#htmlEditFormat(varname)#"</cfoutput>>
0
 
gardineCommented:
How did that go for you?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now