binap
Posts: 10
|
| Posted: 07/23/2008, 10:59 PM |
|
I am new one of codecharge studio. When i am doing Grid and Record Builder Search, List and Add/Edit page appear. I am placing a link in list page called "Add New". When i am click the Add New link, Add/Edit page should appear. Otherwise it is not shown.
Can any one tell how to do this in php or asp using templates.
thanks in advance.
|
 |
 |
ReneS
Posts: 225
|
| Posted: 07/24/2008, 2:13 AM |
|
Hi,
You could use panels, search in help for panels and show/hide components.
Rene
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/24/2008, 5:53 AM |
|
further to Rene:
Puyt the Record on a panel.
Panel is initialy Visible:False (No)
BeforeShow of the panel test the URL for the parameter you are supplying
(for instance prod_id)
if ( CCGetFromGet(prod_id,0))
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/24/2008, 5:54 AM |
|
[dupped\]
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
binap
Posts: 10
|
| Posted: 07/25/2008, 12:19 AM |
|
i am not using without panel how it could be possible
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/25/2008, 1:11 AM |
|
What version of CCS are you using?
What language? PhP/MySQL?
Basics, without using Panels (preferred method!) using PhP/MySQL (CCS 3.x 4.x).
Based on InternetDB, store_products table, generated default Grid/record, URL parameter is product_id.
BeforeShow of the Record component
//Custom Code @31-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
if ( CCGetParam("product_id",0) ==0) {
$Component->Visible = False;
}
//End Custom Code
The Add/Edit is now NOT shown, unless ?product_id= is on the URL, so if a record is selected for change.
In the Record Component properties set the Remove Parameters = product_id
This will make sure that the product_id is removed from the URL when the Record is submitted and the Record is hidden.
This takes care of the Edit/Delete mode, Add mode will be next task.
In Design, click the "Add New" Link and in its properties find "Href Source:<yourpagename>.ccp
Press the [...] top open up the HrefSource dialogue, click the Parameters Tab.
Press the "+" to add a new parameter, type=Expression, ParameterSource=AddNew, ParameterName=Action
Press OK to save this.
In Desing Select the Record Component, to open up it's properties.
alter the Remove Parameters = product_id;Action
Next, change the BeforeShow code entered earlier:
BeforeShow of the Record component
//Custom Code @31-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
if ( CCGetParam("product_id",0) ==0 AND !CCGetParam("Action","") ) {
$Component->Visible = False;
}
//End Custom Code
The CCGetParam("product_id",0) checks to see if a parameter product_id exists, if not it will default to 0.
The CCGetParam("Action","") checks to see if a parameter Action exists, if not it will default to spaces.
Hope you like and use this.
Thats all, even using panels the basic method would be the same.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
binap
Posts: 10
|
| Posted: 07/25/2008, 6:21 AM |
|
one doubt,
here $Component->Visible = False;
$Component means what? or how to print a Component name in a page.
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/25/2008, 7:57 AM |
|
$Component is the way to address the current component.
In above example it refers to the Record itself.
You can read it in the source block a few lines above from where you type code.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
binap
Posts: 10
|
| Posted: 07/25/2008, 7:47 PM |
|
I am using CCS 4.x, MySQL and WAMP server which is latest versions.
The table is
DROP TABLE IF EXISTS `country`;
CREATE TABLE IF NOT EXISTS `country` (
`COUN_ID` int(11) NOT NULL auto_increment,
`RE_ID` int(11) NOT NULL,
`COUN_NAME` varchar(20) NOT NULL,
PRIMARY KEY (`COUN_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
In product_id place i am using COUN_ID. Here Add/Edit form is not hiding. It showing always. The table has already records exits.
I think this is the not the right procedure. 
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 07/26/2008, 3:24 AM |
|
The procedure is right and tested.
Everywhere it says product_id replace it with COUN_ID.
It is written for a basic
SEARCH
GRID
FORM
generated using the Grid record builder.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|