Skip to main content
February 8, 2009
Answered

Dropdown Menu

  • February 8, 2009
  • 2 replies
  • 403 views
Sorry if this post is really long.

I do a gaming site and I wrote an application so that people could list their treasure priorities. The finished product looks like: http://botdls.com/EinherjarPriorities/einherjar_priority_index.cfm

The problem that I am having is that I am using a cfc system that came out of Ben Forta's book and I can't figure out how to make the priority stuff on the add/update pages a drop down menu. What I am trying to do looks like this: http://migcfdesign.com/EinherjarPriorities/items.gif
When adding a new member, I need the dropdown to be inserted into the database. When updating a member, I need the field to be filled in like it is in the picture and if you don't want to change it, when you submit the form I need it to update with that same value. However, if you decide to change it via the dropdown menu, I need that value to be submitted. I hope that makes sense. Here is all the code for the whole application.
This topic has been closed for replies.
Correct answer Dan_Bracuk
quote:

Originally posted by: MIGhunter
Sorry if this post is really long.

I do a gaming site and I wrote an application so that people could list their treasure priorities. The finished product looks like: http://botdls.com/EinherjarPriorities/einherjar_priority_index.cfm

The problem that I am having is that I am using a cfc system that came out of Ben Forta's book and I can't figure out how to make the priority stuff on the add/update pages a drop down menu. What I am trying to do looks like this: http://migcfdesign.com/EinherjarPriorities/items.gif
When adding a new member, I need the dropdown to be inserted into the database. When updating a member, I need the field to be filled in like it is in the picture and if you don't want to change it, when you submit the form I need it to update with that same value. However, if you decide to change it via the dropdown menu, I need that value to be submitted. I hope that makes sense. Here is all the code for the whole application.

You posted more code than I am willing to read. For the form in your image, it looks like a straightforward update form. What code runs when you submit it?

2 replies

Inspiring
February 14, 2009
Are you using cfselect? The query and selected attributes are rather handy.
February 15, 2009
quote:

Originally posted by: Dan Bracuk
Are you using cfselect? The query and selected attributes are rather handy.

Man that's awesome. Just what I needed. Someone on easycfm.com was helping me do some stuff with Ajax but this is the simple fix I was looking for. One more question though. The original form is blank if you are adding a user. If you are updating a user it fills in the form with the stored database info. Is there a way to do that with cfselect? The stored info would be whatever is in the dropdown menu so it's all the same info. Basically, It's 4 fields and people might only want to update 1 of the 4 fields. I don't want them to have to reclick or even remember what their old entries are.

----------------------------------------------------------------------------------------
{Edit}-Found the answer to this on Forta's blog. Surprised it isn't listed in the livedocs. If you place QUERYPOSITION="below" it fixes it.
also, along the same lines, I use this code which put's the "None" option at the bottom of the list. I played with it and can't figure out how to get it to place "None" at the top of the list. Is there a way to do this?
February 15, 2009
Nevermind. For some reason it wasn't working and then it was. Here is the way to do it.
Dan_BracukCorrect answer
Inspiring
February 8, 2009
quote:

Originally posted by: MIGhunter
Sorry if this post is really long.

I do a gaming site and I wrote an application so that people could list their treasure priorities. The finished product looks like: http://botdls.com/EinherjarPriorities/einherjar_priority_index.cfm

The problem that I am having is that I am using a cfc system that came out of Ben Forta's book and I can't figure out how to make the priority stuff on the add/update pages a drop down menu. What I am trying to do looks like this: http://migcfdesign.com/EinherjarPriorities/items.gif
When adding a new member, I need the dropdown to be inserted into the database. When updating a member, I need the field to be filled in like it is in the picture and if you don't want to change it, when you submit the form I need it to update with that same value. However, if you decide to change it via the dropdown menu, I need that value to be submitted. I hope that makes sense. Here is all the code for the whole application.

You posted more code than I am willing to read. For the form in your image, it looks like a straightforward update form. What code runs when you submit it?
February 14, 2009
Sorry, have been to busy to play with this. It is a standard update. The whole application is a cfc so that it does add, update and delete all in one form. I'm thinking I might need to take a different approach.

Anyway, the problem that i'm having with the current set up is the update form. I need to have it prefill in the form. I have it set up for that now. The problem I'm having is I can't figure out how to make a drop down list for 4 of the fields. I don't want people to be able to put in anything but stuff from the dropdown menu.