Solved

CF adding value to cfselect list

Posted on 2010-08-12
2
241 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cfpdfform and populate 14 70
Database structure 4 141
expandPath erroring 15 63
trying to resize an Image, using CFimage tag. 8 32
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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