Solved

CF adding value to cfselect list

Posted on 2010-08-12
2
236 Views
Last Modified: 2012-06-21
Hello Experts.
Please help.
I have two forms
Parent.cfm   -   has cfselect LIST1 and cfinput BOX1
Child.cfm  -       popupwindow with cfinput BOX2
 I need to pass val from BOX2 to LIST1.
I have no problem to pass val from BOX2 to BOX1 using following

opener.AcceptingControl.value = val

But how can i add  val to LIST1 using the same approach?

Thank you in advance.
0
Comment
Question by:kqureshi321
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 250 total points
ID: 33423274
>> But how can i add  val to LIST1 using the same approach?

   Create a function on Parent.cfm that adds an option to LIST1.  Something like

           function yourFunctionName(theValue) {
                 var elem = document.getElementById('TheIDOfYourLIST1Control');
                 elem.options[elem.options.length] = new Option(theValue, theValue);
           }

   Then call it from your popup window.

        window.opener.yourFunctioName( valueToAdd );


   BTW: Since select lists have a "value" and "text", you can either use the same
   value  for both in your function _or_ supply two parameters .


0
 

Author Comment

by:kqureshi321
ID: 33424444
It worked! Perfect!
What was missing is this piece :   "elem.options[elem.options.length]".
Thanks a lot!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now