Solved

Multivalues fields - Parsing values

Posted on 2003-10-22
5
396 Views
Last Modified: 2013-12-18
I have a form which holds SLA parameters.  It has a number of hidden multivalue textfields which take the following name format.

CA01_Rec
CA02_Rec
CA03_Rec
DR01_Rec
etc...

Each field has a corresponding button when the user clicks on the button it opens up a window parsing the fieldname in the URL.  

The new window contains a checkbox field of users, when the user selects the users and saves the form the following code fills the value on the parent form.

function updateParent()
{
fieldname = frm.FieldName.value;  
intLength = document.forms[0].elements['Rec'].options.length;
      
if(intLength>-1)
{
     for (i=0; i<intLength;i++)
     {
      newValue= document.forms[0].strList.options[i].text;                 
      if (listval =="") { listval = newValue }
      else                   { listval = listval + ";" + newValue}
     }
}
opener.document._frmSLA[fieldname].value =  listval;
window.close()
}

What I want to do it when the user clicks on the button to open up the window the values in the hidden field are parsed so that the values that the user has previously saved are checked.  Any ideas how I do this?
0
Comment
Question by:fayeb
  • 2
  • 2
5 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 50 total points
ID: 9600768
Paste this code in onload event of the dialog form.

prevVal = window.opener.document.forms[0].MValues.value;    // Parent doc val
var thisform = document.forms[0];
for(i=0; i<thisform.MValues.length; i++) {
if(thisform.MValues[i].value == prevVal) {
      thisform.MValues[i].checked = true ;
}
}



Substitute MValues with your field name appropriately

~Hemanth
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9601707
Hi fayeb,

I'm a little cnfused as to what yuo mean.  I was first thinking along the lines of what Hemanth did, but then I realized you might have meant THE OPPOSITE. Hemanth's code runs in the secondary (popup) window, gets the parent form's field value.  Then, for each current possible checkbox, it checks off the value if it matches.

This does NOT describe how to send values back from th epopup to the main window.  And it does not describe how to retrieve a multiple value field from the main doc.

Multiple value text fields in Notes are sent as a single field, with a separator breaking up the multiple values.  Usually, the separator is a comma followed by a space, but this is configurable within a small set of choices).  So you need to use value.split(",") and then trim off the leading space from each value except for the first.

Multiple value fields that use keywords will make use of the browser equivalent (checkbox, listbox).

Best regards,
qwaletee
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 200 total points
ID: 9601782
So, modifying Hemanth's code to account for multiple values on the source...

function LTrim(str){if(str==null){return null;}for(var i=0;str.charAt(i)==" ";i++);return str.substring(i,str.length);}
prevVal = LTrim(window.opener.document.forms[0].MValues.value.split(","));    // Parent doc val
var thisform = document.forms[0];
for(i=0; i<thisform.MValues.length; i++) {
 for(j=0; j<prevVal.length;j++){
  if(thisform.MValues[i].value == prevVal[j]) {
       thisform.MValues[i].checked = true ;
  }
 }
}
0
 

Author Comment

by:fayeb
ID: 9605090
you seem to be passing a variable called str can you please tell me what that is relating to.
0
 

Author Comment

by:fayeb
ID: 9605294
Thanks guys for both your help.  I managed to work it outand get the code working.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus Notes 41 185
Why won't this building block macro run? 6 285
Send a link through lotus notes automated mail 11 134
Get files more than 50 GB from F drive on list of servers 8 101
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

22 Experts available now in Live!

Get 1:1 Help Now