Thanks for all the suggestions. I think it will be easier to make the
next/previous links into forms and then process the checkboxes that way
rather than with javascript.
Cheers
Dave
At 13:54 10/15/2002 +0200, you wrote:
>Here's a slightly tidier version of that code:
>
><cfoutput>
><!--- Display the results when the form is submitted using a method of
>post --->
><cfif isDefined('form.userlist')>
>The following users were selected:<br>
><cfset lDupes = "">
><ul>
><cfloop list="#form.userlist#" index="i">
><cfif not listFind(lDupes,i)>
>
> <cfset lDupes = listAppend(lDupes,i)>
> <li>#i#</li>
>
></cfif>
></cfloop>
></ul>
></cfif>
><form action="#cgi.script_name#" name="testform" method="post">
><!--- persist the current selection across pages --->
><cfif isDefined('url.userlist')>
> <cfloop list="#url.userlist#" index="i">
> <input type="Hidden" name="userlist" value="#i#">
> </cfloop>
><cfelse>
> <cfset url.userlist = "">
></cfif>
>
><!--- Check which page we are on --->
><cfif not isDefined('url.page')>
><input type="Hidden" name="page" value="2">
><input type="Checkbox" name="userlist" value="user1" <cfif
>listFind(url.userlist,'user1')>CHECKED</cfif>>
><input type="Checkbox" name="userlist" value="user2" <cfif
>listFind(url.userlist,'user2')>CHECKED</cfif>>
><input type="Checkbox" name="userlist" value="user3" <cfif
>listFind(url.userlist,'user3')>CHECKED</cfif>>
><cfelse>
><input type="Checkbox" name="userlist" value="user4" <cfif
>listFind(url.userlist,'user4')>CHECKED</cfif>>
><input type="Checkbox" name="userlist" value="user5" <cfif
>listFind(url.userlist,'user5')>CHECKED</cfif>>
><input type="Checkbox" name="userlist" value="user6" <cfif
>listFind(url.userlist,'user6')>CHECKED</cfif>>
></cfif>
><br>
><br>
>
><a href="#cgi.script_name#"
>onclick="testform.setAttribute('method','get'); testform.submit();
>return false;">
><cfif not isDefined('url.page')>
>Page 2
><cfelse>
>Page 1
></cfif>
></a>
><br>
><br>
>
><input type="submit" value="test">
></form>
></cfoutput>
>
>Spike
>
>Stephen Milligan
>Team Macromedia - ColdFusion
>Co-author 'Reality Macromedia ColdFusion MX: Intranets and Content
>Management'
>http://spikefu.blogspot.com
>
> > -----Original Message-----
> > From: Spike [mailto:[EMAIL PROTECTED]]
> > Sent: 15 October 2002 13:47
> > To: [EMAIL PROTECTED]
> > Subject: RE: [ cf-dev ] SOT: Checkboxes to list for
> > next/previous functionality
> >
> >
> > Yes, that's clearer.
> >
> > Is there any reason why you can't use a form that submits
> > when you click the links?
> >
> > As long as you have the method of that form set to nothing or
> > "get", you will get the values of the check boxes appended to the url:
> >
> > <cfoutput>
> > <cfif isDefined('form.userlist')>
> > The following users were selected:<br>
> > #form.userlist#
> > </cfif>
> > <form action="#cgi.script_name#" name="testform"
> > method="post"> <cfif isDefined('url.userlist')>
> > <cfloop list="#url.userlist#" index="i">
> > <input type="Hidden" name="userlist" value="#i#">
> > </cfloop>
> > </cfif>
> > <cfif not isDefined('url.page')>
> > <input type="Hidden" name="page" value="1">
> > <input type="Checkbox" name="userlist" value="user1">
> > <input type="Checkbox" name="userlist" value="user2">
> > <input type="Checkbox" name="userlist" value="user3">
> > <cfelse>
> > <input type="Checkbox" name="userlist" value="user4">
> > <input type="Checkbox" name="userlist" value="user5">
> > <input type="Checkbox" name="userlist" value="user6">
> > </cfif>
> > <a href="#cgi.script_name#"
> > onclick="testform.setAttribute('method','get');
> > testform.submit(); return false;">Next</a> <input
> > type="submit" value="test"> </form> </cfoutput> Stephen
> > Milligan Team Macromedia - ColdFusion Co-author 'Reality
> > Macromedia ColdFusion MX: Intranets and Content Management'
> > http://spikefu.blogspot.com
> >
> > > -----Original Message-----
> > > From: Dave Phipps [mailto:[EMAIL PROTECTED]]
> > > Sent: 15 October 2002 13:37
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: [ cf-dev ] SOT: Checkboxes to list for
> > > next/previous functionality
> > >
> > >
> > > I don't think I was very clear in explaining what I am trying
> > > to do. The
> > > form submission only happens once the user is ready to submit
> > > it. The
> > > next/previous options are url links to the same page only
> > > showing the next
> > > or previous set of 15 results. If you have chosen any
> > > checkboxes on the
> > > first page these are forgotten as soon as you go to the next
> > > or previous
> > > set. I want some way of storing the selected userid's using
> > > javascript so
> > > that a url var is passed in the next/previous links which
> > > holds the userid
> > > list which can then be added to or taken away from.
> > >
> > > Once the form is submitted then the entire selected list can
> > > be passed in a
> > > hidden field.
> > >
> > > Any clearer???
> > >
> > > Cheers
> > >
> > > Dave ;)
> > >
> > > At 13:12 10/15/2002 +0200, you wrote:
> > > >This ought to do it:
> > > >
> > > >Create all the check boxes you want in the list with the
> > > same name, and
> > > >set the values to the unique identifier for each user.
> > > >
> > > ><cfoutput>
> > > ><cfif isDefined('form.userlist')>
> > > >The following users were selected:<br>
> > > >#form.userlist#
> > > ></cfif>
> > > ><form action="#cgi.script_name#" name="testform"
> > > method="post"> <input
> > > >type="Checkbox" name="userlist" value="user1"> <input
> > > type="Checkbox"
> > > >name="userlist" value="user2"> <input type="Checkbox"
> > > name="userlist"
> > > >value="user3"> <input type="submit" value="test">
> > > ></form>
> > > ></cfoutput>
> > > >
> > > >Spike
> > > >
> > > >Stephen Milligan
> > > >Team Macromedia - ColdFusion
> > > >Co-author 'Reality Macromedia ColdFusion MX: Intranets and Content
> > > >Management' http://spikefu.blogspot.com
> > > >
> > > > > -----Original Message-----
> > > > > From: Dave Phipps [mailto:[EMAIL PROTECTED]]
> > > > > Sent: 15 October 2002 13:06
> > > > > To: ColdFusion User group
> > > > > Subject: [ cf-dev ] SOT: Checkboxes to list for next/previous
> > > > > functionality
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I have a list of users each with a checkbox alongside
> > holding the
> > > > > userid. I want to be able to take the selected
> > > checkboxes and place
> > > > > the values into a list which I can then pass in the url of the
> > > > > next/previous links.
> > > > >
> > > > > I basically want to be able to remember which checkboxes
> > > have been
> > > > > selected no matter how many times someone goes backwards and
> > > > > forwards. Once all the
> > > > > required checkboxes have been chosen then I want this final
> > > > > list to be
> > > > > submitted as a hidden form field.
> > > > >
> > > > > I have looked at a load of javascript sites but can't
> > > find quite the
> > > > > right code. Has anyone done this before or can give me
> > a snippet
> > > > > to get things going?
> > > > >
> > > > > Sorry for the OT post.
> > > > >
> > > > > Cheers
> > > > >
> > > > > Dave
> > > > >
> > > > >
> > > > > ============================================
> > > > > Phipps CF Development
> > > > > Oxford, Oxfordshire.
> > > > > Telephone: +44(0)7718 896696
> > > > > http://www.phipps-cf.co.uk
> > > > > ============================================
> > > > >
> > > > >
> > > > > --
> > > > > ** Archive:
> > > > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> > > > >
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > > > For human help, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >--
> > > >** Archive:
> > > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > > >
> > >
> > > >To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > >For additional commands, e-mail:
> > > [EMAIL PROTECTED] For
> > > >human help, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > > ============================================
> > > Phipps CF Development
> > > Oxford, Oxfordshire.
> > > Telephone: +44(0)7718 896696
> > > http://www.phipps-cf.co.uk
> > > ============================================
> > >
> > >
> > > --
> > > ** Archive:
> > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/
> > >
> >
> > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED] For human help, e-mail:
> > > [EMAIL PROTECTED]
> > >
> >
> >
> >
> > --
> > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> >
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > For human help, e-mail: [EMAIL PROTECTED]
> >
>
>
>
>--
>** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>For human help, e-mail: [EMAIL PROTECTED]
============================================
Phipps CF Development
Oxford, Oxfordshire.
Telephone: +44(0)7718 896696
http://www.phipps-cf.co.uk
============================================
--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]