pre fill input text field of html form

Posted on 2006-04-13
Last Modified: 2013-12-24
  I have a simple html form as below:

<form action="page1.php" method="post">
<td> <input type="text" name="username" size="20" maxlength="40" id="user"><br>
<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.

Question by:kavishshukla
    LVL 1

    Expert Comment


    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">

    LVL 16

    Expert Comment

    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>>
    LVL 1

    Accepted Solution

    How did that go for you?

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
    Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now