Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncated output using input type 'text'

Status
Not open for further replies.

happyjack1

Technical User
Jan 16, 2003
3
US
I have a form requiring data input for all fields. When any field is left blank and the data is submitted, the cgi file generates a new form which is populated with data already input and an error message to fill in the missing data.

An anomaly occurs with the reprinted form. One field often requires input of more than one word from the original form. However, the reprinted form populates the text field with only the first word of the string.

To test this, please go to: .
Enter a bunch of data in the fields leaving a couple of fields blank. In the "Course Played" field enter 3-4 words. Submit the data. The resulting reprinted form will repopulate each text field. However the Course Played field will populate with only the first word of the input string.

A snippet of the Perl used to repopulate the form is :

<td width="25%"><p align="left" class="bold">Course Played </p></td>
<td width="55%"><div align="left"><input type="text" name="course" size="60" value = $in{'course'}></div></td>
<td width="20%"><p align="left" style="color:red">
eoh

#Write out error message if course is missing
if($in{'course'} eq "")
{print "Required field";}
print <<"eoh";
</p></td>


What can I do to populate with the entire string??

Thanks much for your input!

Jack
 
here is your html output
Code:
<td width="25%"><p align="left" class="bold">Course Played </p></td>
                  <td width="55%"><div align="left"><input type="text" name="course" size="60" value = one two three></div></td>
                  <td width="20%"><p align="left" style="color:red">
</p></td>

You need to quote what comes after value or it will only show the first word.
like this
Code:
<td width="55%"><div align="left"><input type="text" name="course" size="60" value = "$in{'course'}"></div></td>

Also.. go look up the CGI module. Way easier once you get used to using it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
ahhh, good one Travis, I missed the missing quotes on another forum. That would definetly account for the truncated data.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Viola! You guys are 'GURUS'. Figures you're here too Kevin. Thanks guys. I can't believe I missed that. So easy but yet soooo illusive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top