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

Passing info to a "locked" field

Status
Not open for further replies.

idaryl

Technical User
Nov 10, 2001
156
0
0
US
I have a calculator on a page (thanks to Chessbot) and I am having the results from a form button on the calculator page:
Code:
<input type="button" value="- Order Platinum -" onClick="window.location.href = 'passD.htm?' + this.form.ttl3.value" name="button3">
sent to a another form on another page --
Code:
<form name="formName" enctype="multipart/form-data">
        <input type="text" name="web_estimate">
        <script language="JavaScript">
				<!--
				document.formName.web_estimate.value = location.search.substring(1);
				//-->
				</script>
        </form>

Is there a way to have the text field on the second page "locked" - so the user cannot change the calculated result?

Also.. on a side note - i've beem trying the TGML to format my posts - but - it doesnt appear - is there some kind of trick to that?
 
Try the readonly parameter
Code:
<input type="text" name="web_estimate" [red]readonly[/red]>

-kaht

banghead.gif
 
You can also, with text inputs, use:

<input type="text" name="web_estimate" onfocus="this.blur();">
 
tgml - you need to click the checkbox "process TGML" by your posts.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Hey guys - thanks! you know after a search I also found this:
Code:
[URL unfurl="true"]http://javascript.internet.com/forms/locked-textbox.html[/URL]

as well - what if there were other text fields (in the same form) on the first page such as room1, room2, room3. How could I amend the 2nd page to show the same text fields with the entries from the first page. All it does at the moment is pass one variable "web_estimate"

I'm assuming that you could add to ( document.formName.web_estimate.value = location.search.substring(1); ) somehow, to incorporate the other fields?!

idaryl
idface.gif
 
I'm assuming that you could add to ( document.formName.web_estimate.value = location.search.substring(1); ) somehow, to incorporate the other fields?!
You could certainly do that. Or another common way to pass values between pages is to store the values in cookies. When you navigate away from the page save all your form values in cookies, then it will load the new page. Upon loading the new page, check for the existance of a cookie. If it exists load the value from the cookie into the form field, if not just leave it blank. I could provide a coding example for this, but they are plastered all over the internet. Google will be your best friend for looking up this information (or the FAQs here in the javascript forum) No sense in re-inventing the wheel.

-kaht

banghead.gif
 
Went out to Google and looked around - the "samples" shown are mostly PHP, or ASP and require working knowledge from those areas (which I definately dont have). Others use the document.write feature to display the results {not what I need) Others

Also.. what if the user has "cookies' disabled? or turned off? The script above just sends the text to: [input type="text" name="web_estimate"]

All I need; is to the ability to add other text boxes, preferably by adding to the existing script (as I kinda understand how it works)

idaryl
idface.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top