Hi everybody,
My problem seems very basic but I don't know how solve it. There is a form which has a text field to input a value and a submit button, and the form action refers to the same template.
Besides the form the page displays two values: the entered one and [here I have troubles] the one entered before. And for the first time let's say the previous value should be "1".
Here is the code I'm playing around with:
The problem with the code is that the previous value is always "1".
Can anyone help with this mess?
Thanks,
Alex
My problem seems very basic but I don't know how solve it. There is a form which has a text field to input a value and a submit button, and the form action refers to the same template.
Besides the form the page displays two values: the entered one and [here I have troubles] the one entered before. And for the first time let's say the previous value should be "1".
Here is the code I'm playing around with:
Code:
<html>
<head>
<cfparam name = "curr_val" default = "1">
<cfparam name = "prev_val" default = "1">
<cfif IsDefined("frm_getValue.curr_val") is "True">
<cfset prev_val = #curr_val#>
<cfset curr_val = #form.curr_val#>
</cfif>
</head>
<body>
<cfoutput>Current value: #curr_val#</cfoutput>
<br>
<cfoutput>Previous value: #prev_val#</cfoutput>
<br>
<cfform name="frm_getValue" action="test.cfm" method="post">
Enter value:
<cfinput name="curr_val" type="text" size="5"></cfinput>
then click
<input type="submit">
</cfform>
</body>
</html>
The problem with the code is that the previous value is always "1".
Can anyone help with this mess?
Thanks,
Alex