Select Multiple from Pop Up Window

Results 1 to 3 of 3

Thread: Select Multiple from Pop Up Window

  1. #1
    Ritter Guest

    Default Select Multiple from Pop Up Window

    Hi All,<BR><BR>I have a screen whenever user creates a new message he enter the basic description like security number and record date and after that he click on the template button which opens a pop up window that gives the list of the templates exists and he can select more than one template from the pop up window and it has to shown on the main window in the order in which user has selected like if he selects description for template in the order 1,3,2 and when he clicks close on template window on the main window it should show description of those templates in text area.<BR>Any idea.<BR><BR>Thanks in advance,<BR>ritter

  2. #2
    Join Date
    Dec 1969

    Default RE: Select Multiple from Pop Up Window

    I&#039;ve done this before and it can all be done in javascript.<BR><BR>First, create a javascript object to hold the template ids and descriptions and an array and counter to hold info about them:<BR><BR>function Template(tID, tDesc) {<BR> this.tID = tID<BR> this.tDesc = tDesc<BR>}<BR><BR>var arrTemp = new Array()<BR>var cntTemp = 0<BR><BR>Then create a function to add items to the template:<BR><BR>function addTemplate(tID, tDesc) {<BR> arrTemp[cntTemp++] = new Template(tID, tDesc)<BR>}<BR><BR>In your asp code, get the template ids and descriptions from the database and loop through the recordset putting them into the addTemplate function:<BR><BR>&#060;%do until rsTemplate.EOF<BR> response.write("&#060;script&#062;addTemplate(&#03 9;" & rs("TemplateID") & "&#039;, &#039;" & rsTemplate("TemplateDesc") & "&#039;)&#060;/script&#062;")<BR> rs.MoveNext<BR>loop%&#062;<BR><BR>That&#039;ll put all the template ids into a javascript object with the id and description there. Create a javascript function to add the descriptions to the textarea:<BR><BR>function addDesc(tID) {<BR> var txt = document.form.TextArea.value<BR><BR> for (var i=0;i&#060;arrTemp.length;i++){<BR> if (parseInt(i) == parseInt(arrTemp.tID)){<BR> txt += &#039;
    &#039; + arrTemp.tDesc<BR> break;<BR> }<BR> }<BR>}<BR><BR>Then in the onclick event of the checkboxes in your child window, add then code:<BR><BR>onclick=&#039;window.opener.addDesc(t his.value)&#039;<BR><BR>That&#039;ll put the id from the checkbox into the function on the opener window, which will put the description with that id into the textarea.<BR>

  3. #3
    Ritter Guest

    Default Thanks Peter

    Thanks a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts