CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

  ~ Passing data from 1 form to another

Print topic Send  topic

Author Message
bigtoe

Posts: 115
Posted: 07/08/2004, 10:10 PM

Hi,

CCS has generated 2 forms for me.
1. form_basic
2. form_extra

form_basic contains the fields:
id = char(7), identification number, text field
fn = char(15), first name, text field
ln = char(15), last name, text field

form_extra contains the fields:
id = char(7), identification number, label
fn = char(15), first name, label
ln = char(15), last name, label
nt = char(50), notes, text field
rg = char(10), region, text field
sc = char(12), section, text field

When the user clicks on the "Add Notes" button in form_basic, how do I:
a. Take the user to form_extra
b. Set the default values in form_extra to the
corresponding values from form_basic like this

form_extra.id is assigned form_basic.id
form_extra.fn is assigned form_basic.fn
form_extra.ln is assigned form_basic.ln


So the user only enters the notes, region and
section information and then clicks on the
"Add" button to add this information to the
form_extra record.

Thanks.
View profile  Send private message
klwillis


Posts: 428
Posted: 07/09/2004, 10:05 AM

Within form_basic, use the SetTag action
within the 'Before Show' event as follows ...

Set the 'Tag Name' to: Action
Set the Expression to: 'form_extra.php'

What this does is force form_basic to post
it's results to the next form.

You can then use the 'Retreive Value for Control' actions
to set the values within form_extra.

Hope that helps. :-)


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
bigtoe

Posts: 115
Posted: 07/09/2004, 3:44 PM

Thanks klwillis.

I will try this out.

View profile  Send private message
klwillis


Posts: 428
Posted: 07/09/2004, 9:49 PM

Modifying template variables is very powerful and
Code Charge let's you make these changes easily
with the SetTag action. :-)

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
bigtoe

Posts: 115
Posted: 10/12/2004, 4:49 AM

Hi klwillis,

I am trying to use SetTag, Before Show, etc.
I am doing something wrong.

Can you explain this with a simple example with more details?

Also, I don't understand how a "Before Show" for the current
form will post the results to the next form?

As I understand it, a "Before Show" applies to the current
form before the current form is displayed.

Thanks.

View profile  Send private message
klwillis


Posts: 428
Posted: 10/12/2004, 6:18 PM

Use the SetTag action for form 'form_basic'.

You don't need to use the 'Before Show' event
in form 'form_extra', you can use 'CCGetParam()' for
the code expression data source value for each of the controls
on this forn.
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
bigtoe

Posts: 115
Posted: 10/17/2004, 3:11 PM

The suggestions mentioned above sound simple but I am still having problems.

(Note: the fn field in form_basic is a Label.)

For fn, in form_basic in CCS:
Server-Before Show-Set Tag:
Tag Name pass_tag1
Expression "form_extra.php"

For f_name, in form_extra in CCS:
Server-Before Show-Retrieve Value for Control:
Control Name f_name
Source Type Expression
Source Name CCGetParam("pass_tag1","")

When form_extra.php page is displayed, its f_name is empty.
The f_name field should contain the text "John" because
the fn field in form_basic.php contains the text "John"


What am I doing wrong here?

View profile  Send private message
klwillis


Posts: 428
Posted: 10/18/2004, 2:34 PM

Within the 'Before Show' event for form_basic, add the
following for the 'Set Tag' action:

Tag Name : Action
Expression : 'form_extra.php'

Hopefully, that does it for you. ;-)

Quote bigtoe:
The suggestions mentioned above sound simple but I am still having problems.

(Note: the fn field in form_basic is a Label.)

For fn, in form_basic in CCS:
Server-Before Show-Set Tag:
Tag Name pass_tag1
Expression "form_extra.php"

For f_name, in form_extra in CCS:
Server-Before Show-Retrieve Value for Control:
Control Name f_name
Source Type Expression
Source Name CCGetParam("pass_tag1","")

When form_extra.php page is displayed, its f_name is empty.
The f_name field should contain the text "John" because
the fn field in form_basic.php contains the text "John"


What am I doing wrong here?


;-)
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
bigtoe

Posts: 115
Posted: 10/18/2004, 10:18 PM

Ok, but how does this ensure that the value in label "fn" in form_basic is passed?

As opposed to any other data in form_basic.
View profile  Send private message
klwillis


Posts: 428
Posted: 10/19/2004, 11:39 AM

I thought fn was an edit control within the form, not a static label.

Every form data control (edit control, listbox, radio button, etc...)
will be posted to the new form, but it's up to the receiving form to
look at the values it needs.

Quote bigtoe:
Ok, but how does this ensure that the value in label "fn" in form_basic is passed?

As opposed to any other data in form_basic.


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 12:38 PM

bigtoe,

I noticed that you you might've asked a "wrong" question, thus the confusion. I don't even know if I could implement such functionality in a simple way.
From what I see, you don't need to pass anything between forms, just have the 2nd form display the data from the database, which might've be added via the 1st form today, yesterday, or even without any form. I just don't see relation to the 1st form.
Thus you would just create an SQL query for your 2nd form, or use use the example at http://docs.codecharge.com/studio/html/ProgrammingTechn...leDBValues.html , which essentially does the same thing - retrieves some information from the database and assigns it to labels. Also look at the "Multi-Step User Registration" example in CCS Example Pack - there 1 form is added, then another form (on 2nd page) is used to add additional data. It should not be a problem to display some data from the 1st form using the code from the example I just mentioned.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
bigtoe

Posts: 115
Posted: 10/19/2004, 2:14 PM


klwillis, peterr

Thanks for being patient as I muddle through this.
Yes, I have asked the wrong questions.
In fact, I have caused confusion in above posts.
I am sorry aobut that.

I hope I can clarify this:

Initially, I said that
fn = char(15), first name, text field in form_basic
fn = char(15), first name, label in form_extra
And I wanted form_extra fn to get the data that was entered in form_basic fn
To accomplish this, peterr is correct.
I can just get the data from the database.
Problem solved. Case closed.

But later on I said that
the fn field in form_basic is a Label
and
that the f_name field in form_extra should be assigned its value

I forgot to mention that:

a. I changed the fn field in form_basic to a Label.
So fn in form_basic is (currently) a label.
The value of fn is not saved in form_basic.

b. f_name is a text field in form_extra

c. There is an "Add Notes" link (not button) in form_basic.
When the user clicks on this link, I want the value from
fn (form_basic) to be passed to f_name (form_extra).


To accomplish this, klwillis has made the appropriate suggestions ...
Quote :
Within the 'Before Show' event for form_basic, add the
following for the 'Set Tag' action:

Tag Name : Action
Expression : 'form_extra.php'

I did this.

Now when the "Add Notes" link is clicked, I can see
form_extra.php and PHPSESSID in the URL
But nothing else in the URL. Why is that?

Here are the "Add Notes" link properties:
Name: Link_Add_Notes_1
Control Source Type: Code Expression
Control Source: "Add Notes"
Data Type: Text
Format:
Default Value:
Content: Text
Href Type: Page
Href Source: form_extra.php
Convert URL to: None
Remove Parameters: F_Primary_KEY
Preserve Parameters: GET
DFFormat:

If I construct the URL manually in Notepad with the appropriate tags
and then put the URL in the browser, it works.
So I know the form_extra.php can obtain the data, if the data is passed to it.

This why I am stuck on this (Passing data) issue:
In form_basic when the "Add Notes" link is clicked, I can see
form_extra.php and PHPSESSID in the URL
But nothing else in the URL. Why?

View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 2:28 PM

Thanks, I think that I understand this better now.
Now it looks to me like what you doing is very similar to the "Pop-up List & Smart Lookup" example in CCS Example Pack. There is also a form with a link to another form/page, and when the link is clicked then the "Manager" field is carried to the next form.
Am I right that this is what you're implementing?

The only issue I see now, is that it is not easy to read Label values because they are just text displayed on the screen. The HTML will just contain text like "abc" and there is no way to retrieve it, unless you assign some ID to the text, table cell, etc.
It may be simpler to create 2 fields: one Label and one Hidden, both containing the same text/value. The Label would be used to display the text, while Hidden would be used to retrieve/process the text in any way you like, for example like the "Manager" in the above example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
bigtoe

Posts: 115
Posted: 10/19/2004, 2:47 PM


peterr,

Yes, you are right this is what I am implementing.

Yes, I have given an id to the fn field in form_basic
The form_basic.html code shows:

< font size = "1" id = "fn" >
{fn}
< /font >

I get no errors with this id.
How can I make this work?
Meaning - How can I get "fn" to be appended to the URL?
(Remember, this is just a label with an id.)

Do I still need to create a corresponging hidden field?



View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 2:59 PM

I don't have such project right now to play with, but I would just follow the instructions from that example: "12. Switch to HTML mode and add the OpenPop_UpList() JavaScript function as shown in the example.".
Since you have the ID then a Hidden field indeed should not be needed, but I cannot be sure without testing or researching this topic. The JavaScript getElementById function used in our example may work, but if not then you may need to refer to some JavaScript resources on the net. I usually "hack" those things by testing my JavaScript with plain HTML, without CodeCharge Studio. If one method doesn't work then I try another. Since the goal here is only to retrieve some ID'd text value then you could create a simple HTML that does just that, then test and adjust it until you get what you need.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.