Solved

CF adding value to cfselect list

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

838 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