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

refering to the input on one form from another form 1

Status
Not open for further replies.

imarosel

Technical User
Jun 23, 2005
149
US
Hello,

I have a function on asp page 1 that is run everytime asp page 2 (with multiple tabs) is loaded. I am adding a loop that loops through a database to determine which input fields should be locked. What is the proper syntax for refering to the inputs on asp page 2 from asp page 1?

forms.asppage1.inputboxname.disabled=true?

something like that?
 
session variables...

page1.asp
<%
dim val1
val1="blah"

session("val1")=val1
%>
page2.asp
<%
if session("val1")="blah" then
response.write "blah"
end if
%>

-DNG
 
I must not have stated my questions clearly enough.
These are user input boxes. When asp page 2 is loaded all the input boxes are populated with what the user may or may not have put in at an earlier date. The user has the option to edit some information but not all depending on the date etc, that is what the database is for. I want to disable certain input boxes, but still display the value that was previously submitted.

What I originally submitted is overly simplistic, but what I'm looking for is the syntax for refering to another form, I will use that syntax in a looping structure etc.
 
Let me say more.
I don't want to assign a global variable to each user input field because of the number of fields etc. I know there has to be some way to refer to a specific input field on a specific form and have it disabled.
 
So you want to conditionally disable the input textbox on an HTML form.

The condition on which the text input is disabled or not disabled is determined by comparing the current date to the date value from your database.

Is this corrrect?
 
Almost, I have a table that lists all the global variables that my form inputs write to as well as the pages the forms are on. In this table I have a column titled "locked" If there is a certain value in the locked column I want to disable the field on the user form.
 
I'm having some luck with javascript (which I know nothing about) Looks like Java script has the following:

document.formname.fieldname.disabled=true
 
The web browser parses HTML into the Document Object Model.

Then the browser-side scripting language can be used to interact with the Document Object Model.

Suppose you have a bit of HTML like this:[tt]
<form name="Myform" method="post" action="somepage.asp">
<input type="text" name="OneFish" value="RedFish" disabled>
<input type="text" name="TwoFish" value="BlueFish">
<input type="text" name="ThreeFish" value="OldFish" disabled>
<input type="text" name="FourFish" value="NewFish">
</form>
[/tt]
When the browser parses that into the DOM you could then use client-side script to discover which fields are disabled and which are not... also you could change the value of the disabled property from true to false;


It is best to use JavaScript for browser-side scripting because it is supported by the most browsers. You could also use VBScript for this purpose that is only a serious option in a situation where every user will have access to Internet Explorer... so basically if you are making a intranet site for internal company use only and also everyone in your company has Internet Exploder then you might choose to use VBScript for your client-side work... in any other situation using JavaScript will net a higher percentage of potential users.
 
the vb/ javascript with IE was something I did not know. Makes total sense in hindsight, but I had no idea. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top