What I am doing is setting the form action to the current page, then
including a tag <cf_quote-process> and that template checks to see if a form
has been submited before running the calculations needed.  There's no reason
I couldn't have what is in the template in the main page, it just looks
tidier this way, so if it would help to move it into the main page, I can.

Adrian's solution is working quite well, but I agree, it could be done a lot
lot better.

Many thanks all for replies ..

Jenny

-----Original Message-----
From: Dave Phillips [mailto:[EMAIL PROTECTED]
Sent: 30 July 2008 22:39
To: CF-Talk
Subject: RE: Form question


Jenny,

Is your action page the same page that your form is on, or is it a different
template and you do a cflocation back to the form template?

If it's the same, then Adrian's method should work.

If it's a different template, then you need to do it a bit differently:

Store a hidden field with the anchor name:
<input type="hidden" name="anchor_name" value="">
<input name="height" type="text" class="inputNumber" id="height"
onchange="this.form.anchor_name.value = 'yourAnchorHere';
document.forms['process'].submit();" <cfif
isdefined("session.height")>value="#session.height#" </cfif> />

Now, at the end of your action template, when you do a "cflocation" back to
the form template, add to your url like so:

<cflocation url="myformurl.cfm###form.anchor_name#">

Remember you need the double ## so that a # actually gets sent.

Dave

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 30, 2008 4:29 PM
To: CF-Talk
Subject: RE: Form question

The quick and dirty answer is:

<input name="height" type="text" class="inputNumber" id="height"
onchange="this.form.action += '#yourAnchorHere';
document.forms['process'].submit();" <cfif
isdefined("session.height")>value="#session.height#" </cfif> />

But as Dave said, there are much better ways to do this. I'd do it with some
jQuery myself.

Adrian

-----Original Message-----
From: Jenny Gavin-Wear [mailto:[EMAIL PROTECTED]
Sent: 30 July 2008 22:11
To: CF-Talk
Subject: RE: Form question


Hi Adrian,

Many thanks for the helpful reply, I'm still not very conversant with
Javascript.

An example of the code I've used is:
<input name="height" type="text" class="inputNumber" id="height"
onChange="document.forms['process'].submit();" <Cfif
isdefined("session.height")>value="#session.height#" </cfif> />

How would I need to change the syntax, please?

Jenny

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: 30 July 2008 17:58
To: CF-Talk
Subject: RE: Form question


In the function that fires onchange, add the #place to the action of the
form.

Something like:

function refreshMyForm() {
        this.form.action += "#myPlace";
}

<select onchange="refreshMyForm()">
        ....
</select>

That needs tidying up and made better but that's the basic idea.

Adrian

-----Original Message-----
From: Jenny Gavin-Wear [mailto:[EMAIL PROTECTED]
Sent: 30 July 2008 17:29
To: CF-Talk
Subject: Form question


I'm working on a quotation page. I have a long (very) form and when elements
in the form change I need it to process a cftag.

I have this working pretty well using onchange to submit the form, but it's
pretty horrible for the user to be returned to the top of the page after
each submit/page reload.

Is there a way I could have the user come back to an anchor after each
reload, and to be able to specify  the anchor for each onchange?

I hope I've explained this clearly enough,

Thanks in advance,

Jenny






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309999
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