paulmason411
Posts: 127
|
| Posted: 08/28/2008, 12:03 AM |
|
Hi Guys,
I will use a calculator example to illustrate my problem. Say that you have a form with two textboxes and a calculate button. When you click calculate it adds textbox1 with textbox2 and return the result in another form.
The problem I'm having is as soon as I hit calculate the values in textbox 1 & 2 disappear. Is there a property or some custom code I can apply to retain these form values. Also my page is JavaScript free so I would like to avoid using AJAX.
Any suggestions would be great. Cheers.
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
datadoit
|
| Posted: 08/28/2008, 4:50 AM |
|
Do you have both forms on the same page?
What operation does your calculate button have (update, insert, search,
cancel)?
Where is your code (button on click, BeforeInsert, etc.)?
|
|
|
 |
paulmason411
Posts: 127
|
| Posted: 08/28/2008, 5:07 PM |
|
Yes both forms are on the same page and there is no operation associated with the button.
I don't want for the calculate form to submit anything to the database as the variables are temporary and don't need to be recorded.
The code is in the Before Show event of a label on form 2. It basically gets the values of the 2 textboxes in form 1 and adds them together.
Let me know if you need more details. Cheers.
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
paulmason411
Posts: 127
|
| Posted: 08/28/2008, 8:48 PM |
|
I had a look at the available On Click events and found some actions called 'Save Control Value' and 'Save Variable Value'. I had a quick attempt but could see any results. Can anyone tell me if they have used these actions successfully?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
paulmason411
Posts: 127
|
| Posted: 08/28/2008, 10:53 PM |
|
I am able to retain/preserve the form values by using the 'Save Control Value' on the button's 'On Click' event. For the destination type I chose Session which is not really what I want, unless I can delete the session variable each time the form is loaded. Is there a way to remove session variables?
I noticed that under destination type there is an option called Application, can anyone explain to me what this does?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/29/2008, 1:42 AM |
|
Paul,
Quick response, have been following yr efforts and thinking:
Are your Forms record Based?
Are the fields at least record fields?
If there is no action to the Button, then you have to create some form of coding to be done upon submit.
If you are using record fields, the upon submit (with action they are available through CCGetParam.
I think you have two choices:
1, use the record, update mode mae it a dummy table, or a dummy row in a table and benefit from all the record handling.
2, handle it as you would any php coded (non-CCS) form.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
datadoit
|
| Posted: 08/29/2008, 6:20 AM |
|
Okay, I'm not in a position at this time to create a detailed example,
but here's an idea:
Your first form should be a search form. Your calculate button for that
form should have an operation of search. What this does is put your
textbox values for that form into the URL. That means that after you
click calculate, those textbox values won't go anywhere after the page
refreshes.
In your second form, in the textbox that you want to show the
calculation, do a BeforeShow event to do the calculation from the URL
parameter values.
$Component->SetValue(CCGetParam("value1","") + CCGetParam("value2",""));
|
|
|
 |
paulmason411
Posts: 127
|
| Posted: 08/31/2008, 8:01 PM |
|
Hey datadoit, Your search idea was exactly what i was after, Thanks
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
|