?
Solved

copy text field data from one form page to another!

Posted on 2006-05-17
9
Medium Priority
?
282 Views
Last Modified: 2012-06-27
Hi All,

This is Sam. This time my question is going to be the most simple one I'd ever asked.

What command I should use to copy the text field "text1" data in the page "form1" to another text field "text2" in the page "form2"?

thisform.text2.value=thisform.text1.value

This is definitely wrong and an error message displays "text2 does not exist."

Sam.
0
Comment
Question by:sami_hung
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 7

Expert Comment

by:Clever_Bob
ID: 16705670
Hi Sam, it looks like you're developing a website in ASP?

If so, the problem is that you can't directly copy data from one webpage to another

The best way to do this would be to set up a 'form' using a <form> tag and a submit button within the <Form> </Form> tags.

The Submit button takes you to the 'Form2' page and you can interpret the data from your first page there by referencing the objects on the form on your previous page
 
0
 
LVL 7

Expert Comment

by:Clever_Bob
ID: 16705718
I should also have added, you need to use the request object to get your info from the second page... e.g..

a = Request("inputfield")

and your form tag should look like this

<form METHOD="post" ACTION="page2.asp" id="frmCreate" name="frmCreate">

0
 

Author Comment

by:sami_hung
ID: 16706067
Hi Clever Bob,

Well one thing I have to make myself more clear is that I'm not developing a web page in ASP or something, but just using the old version of Visual Foxpro (V6.0). I should write in more details of my question, or actually a very simple question:

I now generated two forms ("form1.scx" and "form2.scx") and "form1" contains text field (text1) and "form2" contains text field (text2). I'm writing a search function in form2.scx in order to copy data from "text2" to "text1".

I had tried this way: "thisform.text1.value=thisform.text2.value"
As I run this command it generates an error message "text1 does not exist." (because text1 is not in "form2"). In other words I cannot use "thisform.text1.value" in search function.

Please help,
Sam.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:hiteshgupta1
ID: 16706888
have u tried using following?
form1.text1.value=form2.text2.value
0
 
LVL 3

Expert Comment

by:arch_great
ID: 16707049
Hi Sam

It will not work.
Since thisform is only the current form.

Tell me do you want the value of Form2 ,text2 to have the same value as form1 text1  at run time ?
which means form1 is also running and form2 is also running ?


Case -1
------------------
If you are calling form2 from form1 , you can do the fo,llowing

do form form2 with thisform.text1.value

In Init of Form2

lPAramter cFrm1txt1val
thisform.text2.value = cFrmtxt1val


This will put form1's text1's value in form2 text2 (i noticed it is reverse of what you asked...pls swap the forms accordingly :-))

************

Case 2
--------
If you are not calling the second form from first form
and it is an independent form ...and both can be selected from the menu and run simulataneously
then

in Form1

If vartype("Form2") = "O"
       thisform.text1.value = form2.text2.value    
Endif

-Archana


0
 

Author Comment

by:sami_hung
ID: 16714300
Hi archana,

Thanks for your idea. I think it works.
But what if more than 1 text field I'm concerning, say 2 text fields, 1 grid window and 2 other buttons. At grid window I want to use form2.search.click() to control the grid window and other 2 text fields in form1 to make it as enabled=.f., and 2 buttons as enabled=.f..

Can I write as follows:

     do form form2 with thisform.text1.value, thisform.text2.value, thisform.grid1.enabled, thisform.addbtn.enabled, thisform.editbtn.enabled

lparameter m.form1_value,m.grid1_enabled,m.addbtn_enabled,editbtn_enabled
thisform.text2.value=m.form1_value
m.grid1_enabled=.f.
m.addbtn_enabled=.f.
m.editbtn_enabled=.f.

Sam.
0
 
LVL 3

Accepted Solution

by:
arch_great earned 40 total points
ID: 16727775
Dear Sam

I think I didnt follow ...
You are passing 2 text values
and 3 logical values ....

you can accept them in the second form
What you want to do with the other values ?

If you want those to be used across the form, you can create form level properties and set it in that.

do form form2 with thisform.text1.value, thisform.text2.value, thisform.grid1.enabled, thisform.addbtn.enabled, thisform.editbtn.enabled

The Other form
Init method
lparameter m.form1_value,m.form2_value,m.grid1_enabled,m.addbtn_enabled,editbtn_enabled

thisform.addproperty("SearchVal")
thisform.text2.value = m.form1_value
thisform.Searchval = m.form2value && this search value can be used in some other method too in this form.

thisform.grid1.enabled = m.grid1_enabled && or whatever you want.

I think 18 parmaters can be sent ... I am not sure.... It depends on what is the requirement ...

HTH
-Archana




0
 
LVL 2

Expert Comment

by:kcchenkd
ID: 16745981
I will put them in session variable

e.g.

on code behind of form 2:
Session("NameOfVarible")=thisform.text2.value

on code behind of form 1:
thisform.text1.value=Session("nameOfVarible")
0
 

Author Comment

by:sami_hung
ID: 16850408
Hi All,

This question seemed open for long, and I had found another way out to solve it. Thanks for all of you sharing your time with your precious solutions.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

850 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