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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display value in form?

Status
Not open for further replies.

michael12

Programmer
Sep 26, 2002
25
0
0
US
I have html code:
------
<form action=admin.cgi method=post>
<input type=text name=name value=&quot;&quot; onChange=&quot;this.form.url.value=this.value;&quot;>

<input type=text name=url value=&quot;&quot;>

------

Second text box can update the contents the same as first text box, now I want to show the contents on html page instead of using &quot;url&quot; input text box, so user cannot modify it, how can I do that?
 
is this kind of what you're looking for?
<script>
function exchange(x) {
form1.url.value = x;
}
</script>
</HEAD>
<BODY>

<form name=&quot;form1&quot; action=&quot;admin.cgi&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;blah&quot; onblur=&quot;exchange(blah.value);&quot;>
<input type=&quot;text&quot; name=&quot;url&quot; value=&quot;&quot;> You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
This is not my question, I don't want to use the input text box to display the value, how can I get rid of text box and only leave this value so user cannot modify it?
 
Try this:

<form action=admin.cgi method=post>
<input type=text name=name value=&quot;&quot; onChange=&quot;this.form.url.value=this.value;&quot;>

<input type=text name=url value=&quot;&quot; READONLY>
There's always a better way...
 
Try this:

<form action=admin.cgi method=post>
<input type=text name=name value=&quot;&quot; onChange=&quot;this.form.url.value=this.value;&quot;>

<input type=hidden name=url value=&quot;&quot;>

Rick if(($question==&quot;has been bugging me&quot;
AND $answer==&quot;fixed the problem&quot;) OR $answer==&quot;really good post&quot;){
print(&quot;Star&quot;);
}else{
print(&quot;Thanks.&quot;);
}
 
michael12, apologies for reading the question in a hurry. seem a little anxious to that I did though!

tviman: bravo for reading the question NOT in a hurry, a few suggestions. I wouldn't use the onChange event here. it looks bad viewing wise due to the tabing over from the initial text box occurance making the text outlined everytime. The onBlur seems to be a little smoother designing wise. Try this one out
<html>
<head>
<style>
.txtbx { background-color:white;border:none;}
</style>
</head>
<body>
<form action=admin.cgi method=post>
<input type=text name=name value=&quot;&quot; onBlur=&quot;this.form.url.value=this.value;&quot;>
<input type=text name=url value=&quot;&quot; class=&quot;txtbx&quot; READONLY>
</body>
</html> You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top