Scotty
Posts: 20
|
| Posted: 04/02/2005, 6:55 AM |
|
Hi,
Firstly, I'm quite new to PHP and Code Charge....
I've got what I hope is a very easy question. I have a list box called "Status" (which is a grid called "Header", which has the ID column (StatusID) as the 'Control Source' value and a DESC column for the 'Text Column'. I have some custom code on the "After Execute Update" event. Essentially all I need to is retrieve the value the user has entered (from the listbox) and then perform some additional updates. However I'm having no luck in retrieving the StatusID value. NULL keeps being assigned to the variable that I'm using. I've tried the GetValue(), CCGetFromPost(), but I don't know the exact syntax that I should use.....
I've tried the following, but had no luck
$Auth = CCGetFromPost($Header->TimesheetStatus, 4);
and
$Auth = CCGetFromPost($TimesheetStatus, 4);
I've got no idea if any of these are even remotely close.....
Thanks in advance
|
 |
 |
Scotty
Posts: 20
|
| Posted: 04/02/2005, 6:57 AM |
|
Sorry for the multiple post, had a lag on the 'submit'
|
 |
 |
lvalverdeb
Posts: 299
|
| Posted: 04/03/2005, 10:26 AM |
|
I am probably missing something but this should work:
$Auth = CCGetFromGet($StatusID,0);
Please note that in order to retrieve values from POST and GET the form must have been submitted first.
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
 |
 |
Scotty
Posts: 20
|
| Posted: 04/04/2005, 11:30 AM |
|
Hi lvalverded,
Thanks for responding. I tried your code, but $Auth is still getting the default value (of 0). This custom code is forms part of the "After Execute Update" event. I'm assuming this is what your referring to by saying "form must have been submitted first"?
Thanks.
|
 |
 |
lvalverdeb
Posts: 299
|
| Posted: 04/04/2005, 12:34 PM |
|
Hi Scott,
You see I was missing something!!! A quick question: In the scenario you describe, are you updating an existing record, inserting a new one or both? I suspect that the reason you are getting a null value is because the code you indicate is not attached to the correct event.
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
 |
 |
Scotty
Posts: 20
|
| Posted: 04/04/2005, 12:39 PM |
|
Hey Luis,
I am updating an existing record, and the custom code forms part of "After Execute Update" event. If this isn't the correct event, what would be the correct one?
Thanks, Scott.
|
 |
 |
lvalverdeb
Posts: 299
|
| Posted: 04/04/2005, 1:00 PM |
|
Hi Scott,
Can you check is the ListBox has actually a value to pass? To check it out just use the ListBox's Client-Side onchange event and issue an alert(this.value)
Since you've tried, without success, both CCGetFromGet() and $gridform->StatusID->GetValue(), I am unable to figure out what is wrong other than the list box may not be passing a value (or a null, rather) at all.
Sorry I am not of much help.
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
 |
 |
Scotty
Posts: 20
|
| Posted: 04/04/2005, 1:19 PM |
|
Hi Luis,
Thanks for your help and it is certainly appriciated! I tried the "alert(this.value)" as you suggested and the field (StatusID) was corectly populated.
Wasn't familiar with the alert (as you've described it), so I have already learnt something!
|
 |
 |
lvalverdeb
Posts: 299
|
| Posted: 04/04/2005, 1:31 PM |
|
Hi Scott,
Here's the last suggestion I have:
In the ListBox's client-side onchange:
1) Right-Click the OnChange event and select Add Action.
2) Select Submit form and select the form name
This submits the form when you select a value from the listbox and therefore the StatusID value can be retrieved using CCGetFromGet().
Hope this works
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
 |
 |
Scotty
Posts: 20
|
| Posted: 04/04/2005, 2:47 PM |
|
Hey Luis,
No luck on that front with the "submit form" event. Just to make sure that I understand your suggestion proberly, in the Expression component of the "submit form", it put "StatusID". I also tried CCGetFromGet(TimesheetStatusID,0)
Again, thanks for your help....
Scott.
|
 |
 |
lvalverdeb
Posts: 299
|
| Posted: 04/04/2005, 3:39 PM |
|
Hi Scott,
On the Expression datasheet leave the expression field blank and for the Form Name just select the form from the dropdown list.
Luis
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4 |
 |
 |
Scotty
Posts: 20
|
| Posted: 04/05/2005, 3:54 PM |
|
Hi Luis,
Unfortunately this hasn't worked either. Are there any other settings that should be used? It is quite possible that it is something basic that I haven’t done. On the form itself, I have set “Preserve Parameters” to “GET AND POST”. I cant really think of anything else….
Thanks again for your help.
Scott.
|
 |
 |
|