|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
displaying static and dynamic values in one list box
Hi All,
I'm having a situation where I've to create a list box which should have both the static and dynamic values in one box. I'm creating a bookmark listbox in which we should have first three option fields as static i.e bookmarks, add book mark, edit bookmark., after that in the same select box I should get the added bookmark from the database as dynamic. Any clue how to do it? Your valued time would be appreciated. thanks. |
|
#2
|
|||
|
|||
|
Just put them both in the select box:
<select name="bookmarks"> <option value="add">Add</option> <option value="edit">Edit</option> <cfoutput query="bookmarks"> <option value="#bookmarks.value#">#bookmarks.name#</option> </cfoutput> </select>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Yes Kite Thanks for the help, I can able to display the name. The other problem which I'm having is,
I'll have to populate the appropriate page onchange in the select box. For add & edit That should populate add.cfm & edit.cfm and for thedynamic bookmarks it should populate the concern pages.for any chance I'm able to get the first Url value in the javascript and I couldn't able to get the url values after that. Please look at the code below. javascript: <script language="JavaScript"> var v_counturl = "#get_countbookmark.counturl#"; function bookmarkfn(frm) { if (frm.bookmarks_field.selectedIndex == 1) { //create bookmark frm.action = "add.cfm"; frm.submit(); return true; } else if (frm.bookmarks_field.selectedIndex == 2){ //list bookmark frm.action = "edit.cfm"; frm.submit(); return true; } upto this the code is working fine else { for(i=0; i<v_counturl; i++){ frm.action = "#get_bookmark.web_cont_url_txt#"; frm.submit(); return true; } } } </script> in cfm page. <select name="bookmarks_field" style="width:160px;" onChange="bookmarkfn(this.form);"> <option value="">Bookmarks</option> <option value="1">> Bookmark this page</option> <option value="2">> Edit Bookmarks</option> <cfloop query="get_bookmark"> <option value="">>#get_bookmark.web_cont_nm#</option> </cfloop> </select> Could you please help me out to resolve this issue. Thanks. Quote:
|
|
#4
|
|||
|
|||
|
I don't understand this:
for(i=0; i<v_counturl; i++){ frm.action = "#get_bookmark.web_cont_url_txt#"; frm.submit(); Why are you looping over the v_counturl? The form can only submit itself once, so all this seems to me to be doing is submitting on the first loop iteration. You could also avoid using Javascript for this and create a "mini controller" template that just inspects whether the user picked add or edit and then includes the appropriate file to handle each condition, or does a cflocation to a page that handles each condition. |
|
#5
|
|||
|
|||
|
yes I know what you are saying about the Javascript and do you have sometime and explain me how to check with mini controller or with cflocation?
Thanks. Quote:
|
|
#6
|
|||
|
|||
|
Sure, just have the form post to a single CF file (regardless of what they picked). That file looks at the FORM scope and based on what they selected, it either cfincludes the appropriate file (one for add and one for edit), or performs a redirect using cflocation that sents processing to a page that handles add or edit or whatever else you need. Make sense?
|
|
#7
|
|||
|
|||
|
Thanks Kite? (is the real name?)
I've started working towards what you said and get back to you If I lost somewhere. -s Quote:
|
|
#8
|
|||
|
|||
|
Real name is Brian. Kiteless is my handle because I think it sounds kind of cool and unusual, but really because kiteless it is one of my favorite songs by Underworld .
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > displaying static and dynamic values in one list box |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|