joejac
Posts: 242
|
| Posted: 04/27/2009, 4:31 PM |
|
Hello,
I have a grid form1 and a function inside the Default Value of Label1:
function1(CCGetParam("menu_no",""))
But for the home page there is no parameter for menu_no in the URL and the form1 displays a set of records, each one with its corresponding label called menu_no that comes from the database.
But if someone clicks on a menu Item, in this case menu_no will go in the URL. I need for each record to read label menu_no and if there is no menu_no in the URL to insert the numeric value of label menu_no inside function1(CCGetParam("menu_no","")) of Default Value of Label1.
I do not know how to modify the Default Value of a control and in which event. I do not know if I was able to explain myself.
I hope some expert can provide with help. I use PHP/MySQL.
Thanks a lot
Best regards
joejac
|
 |
 |
damian
Posts: 838
|
| Posted: 04/27/2009, 6:27 PM |
|
something like this:
custom code in before show on grid/menu or whatever:
global $menu_no_value;
$menu_no_id = CCGetParam("menu_no", $menu_no_value);
if ($menu_no_id == '') {
$Component->SetValue('defaultvalue');
}
else if ($menu_no_id != '') {
$Component->SetValue($menu_no_id);
}
please note that in this section
$menu_no_id == ''
that is an ' and an ' and not a ".
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
joejac
Posts: 242
|
| Posted: 04/28/2009, 9:16 AM |
|
Thanks a lot Damian, your solution is perfect.
Best regards
joejac
|
 |
 |
damian
Posts: 838
|
| Posted: 04/28/2009, 5:13 PM |
|
i usually use this method to show/hide a component in a page based on the url parameter.... i hadnt used it to set a default value so I wasnt sure if I reworked it properly....
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
joejac
Posts: 242
|
| Posted: 04/28/2009, 7:39 PM |
|
Hello Damian
I did not tested this particular instruction:
$Component->SetValue('defaultvalue');
But I used your idea to read and set the value of the component directly, according to the condition, and it worked.
Best regards
joejac
|
 |
 |
|