OK this is what I have working. Does the job but seems rather complicated
just to get a value passed to another template...
Critiques and improvements welcomed.
Doug
--------------------------------------
<form action="#URLsessionFormat("#self#?fuseaction=#XFA.ShowUserPage#")#"
method="post">
<cfoutput query="UserList">
  <cfoutput>
    <input type="submit" name="Status_#user_id#" value="Status">
  </cfoutput>
</cfoutput>
</form>


in ShowUserPage.cfm:

<cfif ListLen(attributes.fieldnames) GT 0>
  <cfset thisUserID = "">
  <cfset thisfieldname = "">
  <cfset count = "">

  <cfloop index="myfieldnames" list="#attributes.fieldnames#">
    <cfset thisfieldname = variables.myfieldnames>
    <cfif find('_',variables.thisfieldname,1)>
      <cfset count = find('_',variables.thisfieldname,1)>
      <cfif NOT compareNoCase(Left(variables.thisfieldname,
variables.count), "STATUS_")>
        <cfset thisUserID = RemoveChars(variables.thisfieldname,1,
variables.count)>
        <cfbreak>
      </cfif>
    </cfif>
  </cfloop>
</cfif>

-----Original Message-----
From: Jim McAtee [mailto:[EMAIL PROTECTED] 
Sent: April 17, 2005 9:46 PM
To: CF-Talk
Subject: Re: Multiple submitt + variable


Try this.  The trick is that when you get to your action page you loop 
through the form fields looking for one with a name beginning with 
"ActivateMe_".  When you find it, then you peel the user id value off of 
the field name.  I don't use fusebox, so I have no idea how consistent 
this is with that methodology.

<form action="somepage.cfm" method="post">
  ...
  <cfloop query="q">
    #myquery.username#
    <input type="submit" name="ActivateMe_#q.user_id#" value="This One">
  </cfloop>
</form>

In somepage.cfm:

<cfset theuserid = "">
<cfloop index="fieldname" list="#form.fieldnames#">
  <cfset fieldvalue = Evaluate("form." & fieldname)>
  <cfif Left(fieldvalue), 12) is "ActivateMe_">
    <cfset theuserid = ListLast(fieldvalue, "_")>
    <cfbreak>
  </cfif>
</cfloop>


----- Original Message ----- 
From: "Douglas Fentiman" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Sunday, April 17, 2005 4:11 PM
Subject: Multiple submitt + variable


> Hi all,
> I have a form with multiple submit buttons. Each button has a unique
> associated id value. I want to pass the associated id value with the 
> submit button that is pressed.
>
> I have checked out the Multiple_Submit Tag, using <input type="submit"
> name="_fuseaction=#XFA.userApprove#">, which works well with a single 
> id value that can be passed as a hidden form field, but haven't been 
> able to figure out a way to use it with multiple id values.
>
> Also played with appending the id value, <input type="checkbox"
> name="ActivateMe_#user_id#" value="1">, and using a single submit 
> button. Then peeling the id value off in the recieving template. This 
> works but uses a single submit button. I would like to use multiple 
> submit buttons to make it a one click action for the user.
>
> Any Ideas on how to do this?
>
> -CFMX
> -FB3
> -no JavaScript
>
> Thks,
> Doug




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203159
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to