i am just not as up on javascript as i should be, so i am begging someone for help.
i have a parent window with a form on it. in order to keep this form on one page, i have put buttons next to each text field on the parent form that launch a pop-up window. that pop-up window queries a database and builds a form from the resultset (in coldfusion).
after selects one or more checkboxes, the form gets submitted back to itself. i change the coldfusion form values (comes as a string) into a javascript variable.
the string comes in the following format:
allen:Allen|Debbie, baker:Baker|April, ellis:Ellis|Joan
the word before the colon is the nt username, the next word is the last name, and the third word (after the pipe character) is the first name. each set pertaining to one user is delimited by a comma. i do not know how many "sets" of data i am going to get, because users could check any number of boxes.
i did a split function on the comma on the incoming string, and stuffed the results into an array.
now i need to somehow separate the nt user name (part before the colon) from the last name and first name, and stuff the list of nt user names into its own array, and the last name/first name into another. i want to return the nt user names to a text box in the parent window, and the last name/first name to another text box in the parent window. that's the reason i need to split it out somehow. argh.
how can i do this?
this is all of the javascript i have written so far. i can get the results back to the parent form, just not the way i want them. (the variable in the pound signs is how you refer to a coldfusion variable. don't let it throw you):
gratefully yours,
april
i have a parent window with a form on it. in order to keep this form on one page, i have put buttons next to each text field on the parent form that launch a pop-up window. that pop-up window queries a database and builds a form from the resultset (in coldfusion).
after selects one or more checkboxes, the form gets submitted back to itself. i change the coldfusion form values (comes as a string) into a javascript variable.
the string comes in the following format:
allen:Allen|Debbie, baker:Baker|April, ellis:Ellis|Joan
the word before the colon is the nt username, the next word is the last name, and the third word (after the pipe character) is the first name. each set pertaining to one user is delimited by a comma. i do not know how many "sets" of data i am going to get, because users could check any number of boxes.
i did a split function on the comma on the incoming string, and stuffed the results into an array.
now i need to somehow separate the nt user name (part before the colon) from the last name and first name, and stuff the list of nt user names into its own array, and the last name/first name into another. i want to return the nt user names to a text box in the parent window, and the last name/first name to another text box in the parent window. that's the reason i need to split it out somehow. argh.
how can i do this?
this is all of the javascript i have written so far. i can get the results back to the parent form, just not the way i want them. (the variable in the pound signs is how you refer to a coldfusion variable. don't let it throw you):
Code:
<script language = "javascript">
var names = '#form.chkAssignees#';
var names_array = names.split(",");
for (var loop=0; loop < names_array.length; loop++)
{
alert(names_array[(loop]); //this is debug code
}
opener.document.frmAddTask.txtTaskAssignees.value = names_array;
self.close();
</script>
gratefully yours,
april