ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 18th, 2005, 09:39 AM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
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.

Reply With Quote
  #2  
Old March 18th, 2005, 10:02 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
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

Reply With Quote
  #3  
Old March 18th, 2005, 11:49 AM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
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:
Originally Posted by kiteless
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>

Reply With Quote
  #4  
Old March 18th, 2005, 12:25 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
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.

Reply With Quote
  #5  
Old March 18th, 2005, 12:38 PM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
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:
Originally Posted by kiteless
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.

Reply With Quote
  #6  
Old March 18th, 2005, 01:30 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
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?

Reply With Quote
  #7  
Old March 18th, 2005, 02:48 PM
mk_senthil mk_senthil is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 45 mk_senthil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 9 m 49 sec
Reputation Power: 4
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:
Originally Posted by kiteless
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?

Reply With Quote
  #8  
Old March 18th, 2005, 03:31 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
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 .

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > displaying static and dynamic values in one list box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway