PeterJ
Posts: 90
|
| Posted: 04/14/2005, 12:53 PM |
|
Hi
I have a grid with one value which from the database. Below this a form.
I would like to display the value in a text box in the form when the page opens.
I tried using CCGetParam() without success.
Can anyone suggest the best way to achieve what I want please?
Thanks
|
 |
 |
peterr
Posts: 5971
|
| Posted: 04/14/2005, 3:31 PM |
|
You probably cannot do this for couple reasons. One, Label values cannot be retrieved, only set. Two, one form may not be able to access values of another form.
I think that it would be easier to retrieve the value that you need from the same source that the Label retrieves it from. Thus instead of trying to obtain Label's value, obtain the same database value that the Label obtains.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
PeterJ
Posts: 90
|
| Posted: 04/15/2005, 4:02 AM |
|
Hello Peterr
Thank you for the advice. This is the scenario. I want the textbox, by default, to display the value retrieved + 1. I've tried several run-arounds without success. For example, the value is accountID (not auto-increment) It persists in the db as for example '25' and therefore the textbox should display '26' Sounds easy doesn't it!
Can you point me in the right direction please?
PeterJ
|
 |
 |
Nicole
Posts: 586
|
| Posted: 04/15/2005, 5:25 AM |
|
PeterJ,
You can create a Before Show event for a textbox and assign it a new value there. The following Help article should help you: http://docs.codecharge.com/studio/html/index.html?http:...lValue.html?toc
If you need to use a control value in your calculation then that control should be located on the same form. Otherwise you need to retrieve it from a database.
_________________
Regards,
Nicole |
 |
 |
PeterJ
Posts: 90
|
| Posted: 04/15/2005, 6:05 AM |
|
Hi Nicole
Thanks, the BeforeShowEvent will only populate the textbox with the value in the event script. I need to retrieve a value from the database to populate the textbox and it is that which I am struggling with.
Thanks
Peter
|
 |
 |
Nicole
Posts: 586
|
| Posted: 04/15/2005, 6:08 AM |
|
Use CCDLookUp() function to retrieve a value from a database
The example is available at http://docs.codecharge.com/studio/html/index.html?http:...BValue.html?toc
_________________
Regards,
Nicole |
 |
 |
peterr
Posts: 5971
|
| Posted: 04/15/2005, 9:59 AM |
|
BTW, are you able to display non-incremented value in that textbox, like '25'?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
PeterJ
Posts: 90
|
| Posted: 04/15/2005, 10:15 AM |
|
Yes Peterr, no problem with 'default' values such as '25'. I just need to extract the last entry in a column associated with the primary key passed to the page (e.g. s_myvalue) and add 1 to it.
Peter
|
 |
 |
peterr
Posts: 5971
|
| Posted: 04/15/2005, 10:18 AM |
|
OK, then possibly you misunderstood the previous suggestion from Nicole, because if I could retrieve any value then I would also use the Before Show event to increase it.
For example:
FormName.TextboxName.Value = FormName.TextboxName.Value +1
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 04/15/2005, 10:19 AM |
|
Oops, that was ASP. For PHP probably it would be:
$FormName->TextboxName.SetValue($FormName->TextboxName->GetValue() +1);
Or something similar (I don't use PHP often).
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |