DXBLouie
Posts: 21
|
| Posted: 05/16/2011, 3:07 PM |
|
Hi everyone,
i'm quite new to CCS so please bear with me.
i have a table with the following structure
brand_id (hidden on the grid.. it's only shown on top of the page via a separate lookup)
model_id
model_name
this is used in an editable grid where brand_id comes from a URL parameter, model_id is automatically generated/incremented, and the user only has to type in the "model_name"
now this works fine and well, until a user calls the page directly, or deletes the URL parameter from the link..
i'd like to do any of the following:
1. hide the grid completely if brand_id isn't shown in the URL
2. perform a check that would show an error message on top of the grid if "brand_id" URL parameter is missing
3. disallow an INSERT/UPDATE if brand_id is missing **
** in the query builder, i set the WHERE Clause with "brand_id = {brand_id}" and i set it to use IS NULL if the parameter is empty, at least this way if a user calls the grid directly, they wont end up seeing a full list of all the rows.
i know this is probably simple, but i'm just not looking at it from the right direction :)
thanks in advance!
|
 |
 |
ckroon
Posts: 869
|
| Posted: 05/16/2011, 9:24 PM |
|
Put the Editable Grid inside a Panel.
Show the Panel only if the URL value is >=1
_________________
Walter Kempees...you are dearly missed. |
 |
 |
damian
Posts: 838
|
| Posted: 05/16/2011, 11:51 PM |
|
search on or read up on CCGetFromGet - here is an example that sounds very similar to what you are doing: http://forums.codecharge.com/posts.php?post_id=113893&s...rd=ccgetfromget
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
Waspman
Posts: 948
|
| Posted: 05/17/2011, 1:33 AM |
|
yeah panels are the way. hide and show dependent on the GetParam. However, if the user removes both the param and the param name you'll need to through them somewhere else, kinda like a security issue?
_________________
http://www.waspmedia.co.uk |
 |
 |
DXBLouie
Posts: 21
|
| Posted: 05/17/2011, 7:48 AM |
|
Thanks guys.
i was able to do it using the following custom code:
$vm_id=CCGetParam("vm_id","");
if ((!strlen($vm_id))||($vm_id==0)){
$Component->Visible = False;
}else{
$Component->Visible = True;
}
|
 |
 |
|