Richard,

Here's an example of a form using the same page to post data using  
only Coldfusion to give the user feedback that the form has been  
submitted:

<!--- Call our component which handles database updates--->
<cfset mycomponent = createObject("component","components.component")/>

<!--- If we're submitting the form --->
<cfif isDefined('FORM.submit')>
<!--- The component we're calling returns a boolean value of "true"  
when the database is updated --->
<cfset formProcessed = mycomponent.doSomething()/>
<cfif>

<!--- If our form has been processed give them a message telling them  
so --->
<cfif formProcessed>
<p class="notice">Your form has been processed successfully.</p>
</cfif>

<!--- Now here's our form --->
<form name="myform" action="" method="post">
<input type="submit" name="submit" id="submit" value="Post This Form"/>
</form>


-Jon

On Sep 21, 2006, at 2:09 PM, Richard White wrote:

>> On 9/21/06, Richard White <[EMAIL PROTECTED]> wrote:
>>
>> Well, from a usability perspective, you'd probably not want the page
>> to remain totally unchanged.  you'd probably like to give your user
>> some indication that the database insert/update/delete occurred
>> successfully.
>>
>> But yes, you can easily do your database call on the action page,  
>> then
>> re-display the form either via a <cfinclude> or a <cflocation>.
>>
>> What it sounds like you're going for (the whole "no refreshing of the
>> page") would be an AJAX call.  I haven't really played around much
>> with AJAX (other than looking a little into Spry), but others on the
>> list can certainly help you out there.
>>
>> -- 
>
> This makes sense, thanks, i am using the cflocation tag to take it  
> back to the original page at the moment but it was also stated that  
> i could use the same page as the action page. Just out of interest  
> if i set the same page as an action page how would i get it to  
> leave it when the page first loads but only respond to it when the  
> submit button has been pressed?
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253766
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to