Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

Displaying user selection on same page - Part II

Dear Experts,

I have asked this question previously and had got an answer, but now I need to fullfill another requirement, that is the user will also be able to select the appended item and delete it from the list.

Can anyone help?


As Posted last time :
I have a form with a drop down menu box populated from a query from the database with a add button. When the user selects the item from the drop down box and clicks add, I want to display the selected item on the same page (showing the user what he/she has selected), after which the user can make other selections using the same drop down menu box and add the selection which will be appended below what he/she has added on earlier.

How can I do this?
0
TriggerFish
Asked:
TriggerFish
  • 3
  • 2
  • 2
  • +1
1 Solution
 
JimV_ATLCommented:
There is a custom tag called CF_TwoSelectsCombo, which does something very similar to what you're looking to do.

You can get it at http://www.geocities.com/thanny/ or the Macromedia Developer's exchange.

What you're looking to do (without refreshing the page, each time you click add) will require javascript.  If you need a slightly different control, you might be able to use this as a starting point.

0
 
jyokumCommented:
I still had the code from your previous Q. Here's an update that adds the remove functionality.


<cfparam name="form.valueList" default="">
<cfparam name="myList" default="">
<cfif isdefined("form.things")>
     <cfset myList = form.valueList>
     <cfif len(form.removeList)>
          <cfset myList = listdeleteat(form.valueList,form.removeList)>
     <cfelse>
          <cfset myList = listappend(myList,form.things)>
     </cfif>
</cfif>

<script language="JavaScript">
function removeItem(itemNumber){
     document.frmAdd.removeList.value = itemNumber;
     document.frmAdd.submit();
}
</script>

<form name="frmAdd" action="add.cfm" method="post">
     <select name="things">
          <option value="this">this</option>
          <option value="that">that</option>
          <option value="the other">the other</option>
     </select>
     <input type="submit" value="Add Item">
     <input type="hidden" name="valueList" value="<cfoutput>#myList#</cfoutput>">
     <input type="hidden" name="removeList" value="">
<table border="1">
     <cfoutput>
     <cfloop from="1" to="#ListLen(myList)#" index="item">
     <tr>
          <td>#listgetat(myList,item)#</td>
          <td><a href="javascript:removeItem(#item#);">remove this item</a></td>
     </tr>
     </cfloop>
     </cfoutput>
</table>
</form>

0
 
TriggerFishAuthor Commented:
I will close this question, both JimV and jyokum has given me good answers.

JimV's answer is close to what I am looking for, but jyokum has given me solutions which I can apply to other parts of my project.

Points wise, 25 to jyokum and 5 to JimV....any objections?

Thanks for all your help
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SpideyModCommented:
TriggerFish,
You have requested a split that cannot be performed.  Each expert must receive a minimum of 20 points in a technical area.  Let me know how you would like to proceed.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
TriggerFishAuthor Commented:
OK, I have decided to give both experts 20 pts each.
0
 
SpideyModCommented:
Points reduced to 20.

You may now accept one expert's comment as the answer.

Next create a "points for expert2 re 20567868"(replace expert2 with the actual expert's name) question in this same Topic area:
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/
Assign 20 points to it.
Grab the URL of the new question (make sure it has the question number in it) and return here to tell the other expert where to get their points at.

If you need further help or the "points for" question isn't posted within a couple of days, somebody drop a note to me here.  Thanks.

SpideyMod
Community Support Moderator @Experts Exchange
0
 
jyokumCommented:
TriggerFish, please accept a comment as the solution
0
 
SpideyModCommented:
I have performed the split.  Thanks for dropping a note here to alert me.

jyokum,points for you at:
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20601209.html

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now