BruceG
|
| Posted: 02/09/2004, 5:19 PM |
|
I've currently set up a Grid and Record form up on a page. The Grid contains employee summary information (employee_id and name). The employee_id is a link which when clicked in the Grid displays the employee details in the Record. Everything is working fine, but I would like to only display the Record form when an employee has been selected in the Grid. I've tried setting up a "Before Show" event for the Record form with the following code, but it does not seem to work (employee1 is the Record form).
global $employee1;
if ($employee1->ds->RecordsCount == 0) {
$employee1->Visible = False;
} else {
$employee1->Visible = True;
}
I've used this techique in the past with an Employee with associated projects and all has worked fine, but I'm not sure why this doesn't work.
Any help would be appreciated.
Regards,
|
|
|
 |
bguthrie
Posts: 31
|
| Posted: 02/10/2004, 5:45 AM |
|
Issue solved. The following code resolved this issue:
global $employees1;
$p=CCGetParam("emp_id",0);
if ($p > 0)
{
$employees1->Visible = True;
}
else
{
$employees1->Visible = False;
}
Regards,
_________________
Regards,
Bruce |
 |
 |
PeterJ
Posts: 90
|
| Posted: 09/05/2004, 12:09 PM |
|
Hi bguthrie
I was wading through the Forum looking for a similar solution to yours above but with a form containing a drop-down list. The box is populated with records controlled by records "newer than" a date. The selection of a record opens a second browser. I'd like to make this record form invisible if there are no recods in the drop-down. Could you offer advice on adapting your solution above for my form please?
|
 |
 |
bguthrie
Posts: 31
|
| Posted: 09/05/2004, 2:06 PM |
|
Hi Peter,
Could you please clarify. When you say that you'd like to make "this record form invisible", are you referring to the form that contains the drop-down list box?
_________________
Regards,
Bruce |
 |
 |
PeterJ
Posts: 90
|
| Posted: 09/06/2004, 11:20 AM |
|
Hi Bruce
Yes, the form and its contents. I have in mind hiding the form until new records are entered in to a main Db at which point the form + drop-down contained within it will be visible until a specified point in time at which point the form will disappear. A record is entered into the main Db elsewhere on the site, the date uploaded is entered. A SQL statement populates the drop-down based on "WHERE TO_DAYS(NOW()) - TO_DAYS(uploaded) <= 21" for example. It would be invisible when no records are returned and vice versa.
Peter
|
 |
 |
|