Hi All,

I have nothing to gain by not showing you all my code, I have included all 
suggested changes and even am writing to the select list the number of 
elements. note the second item.

here is my code again with the changes and the output below, note the 
items in the list this time are different from the first I think Tim may 
be onto something but can't see where.

Cheers
Colin

#!c:/iw-home/iw-perl/bin/iwperl

my $fileToOpen = shift;

# $string = qq[<option value="$fileToOpen" label="$fileToOpen"/>];

open( FILEHANDLE, $fileToOpen ) or die ("Could not open file 
$fileToOpen");

undef $/;                                  # enter slurp mode
my $inFile = <FILEHANDLE>;

close( FILEHANDLE );

my @splitData = split( /\,/, $inFile );

$numElements = scalar(@splitData);
$optionHTML = qq[<option label="$numElements" />];

foreach $subject ( @splitData ) {

    $subject = xc($subject);
    $optionHTML .= qq[<option label="$subject" />];

}

# produce output
print <<EOF;
<?xml version="1.0" encoding='UTF-8'?>
<substitution>
$optionHTML
</substitution>
EOF
#

sub xc {
    #returns text free of XML baddies - xc = xml clean

    my $data = $_[0];
    $data =~ s/&/&amp;/g;
    $data =~ s/</&lt;/g;
    $data =~ s/>/&gt;/g;
    $data =~ s/'/&apos;/g;
    $data =~ s/"/&quot;/g;

    return $data;
}

and the output:

<select class='multiSelectStyle' name='anotherContainer/Choose Page 
Subject' size=1 onfocus='datacapture.handleElementSelect( 26);' 
onchange='parent.api.iw_dispatch_handleOnChange(26,this);'>
<option value="">
<option value="43"> 43
<option value="BCS Employee"> BCS Employee
<option value="BPFJ+"> BPFJ+
<option value="Community Program"> Community Program
<option value="Employment Confirmations"> Employment Confirmations
<option value="Employee Services"> Employee Services
<option value="Expense Reimbursement"> Expense Reimbursement
<option value="Flexibility"> Flexibility
<option value="Health Benefits"> Health Benefits
<option value="HR Assist"> HR Assist
<option value="Insurance"> Insurance
<option value="Management Development"> Management Development
<option value="New Hire Information"> New Hire Information
<option value="PaylinkPlus"> PaylinkPlus
<option value="PBC Tool - Urgent"> PBC Tool - Urgent
<option value="Peace of Mind Benefits"> Peace of Mind Benefits
<option value="Promotions"> Promotions
<option value="Reporting - Data Quality &amp; Integrity"> Reporting - Data 
Quality &amp; Integrity
<option value="Single Cycle Salary Review"> Single Cycle Salary Review
<option value="Transactional"> Transactional
<option value="When Life Changes"> When Life Changes
<option value="Workplace Practices"> Workplace Practices
</select>








"Tim Johnson" <[EMAIL PROTECTED]>
30/12/2003 08:49 AM

 
        To:     Colin Johnstone/Australia/Contr/[EMAIL PROTECTED], "James Edward Gray 
II" 
<[EMAIL PROTECTED]>
        cc:     <[EMAIL PROTECTED]>
        Subject:        RE: Splitting Comma delimited list




It looks like you are skipping exactly every other element.  This is
most likely a coding error in an area of the code you're not showing us
or inadvertently fixed when you copied it to the email.  I would check
for a place where you might be shift()ing or otherwise pulling an
element out and assigning it to a variable twice by accident so that one
result gets thrown away, or something along those lines.



-----Original Message-----
From: Colin Johnstone [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 29, 2003 1:40 PM
To: James Edward Gray II
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting Comma delimited list

Hi James,

Thanks for the tips, I took your advice here is the HTML returned, There
still isn't the full 43 elements though strange?

<select class='multiSelectStyle' name='anotherContainer/Choose Page
Subject' size=1 onfocus='datacapture.handleElementSelect( 26);' 
onchange='parent.api.iw_dispatch_handleOnChange(26,this);'>
<option value="">
<option value="About You"> About You
<option value="Sales Recognition Events Framework"> Sales Recognition
Events Framework <option value="Building Wealth"> Building Wealth
<option value="Compensation"> Compensation <option value="Employee
Development"> Employee Development <option value="Executive
Development"> Executive Development <option value="Financial Benefits">
Financial Benefits <option value="Global Pulse Survey"> Global Pulse
Survey <option value="Hiring"> Hiring <option value="IDP Tool"> IDP Tool
<option value="Manager Services"> Manager Services <option
value="Mobility"> Mobility <option value="Other"> Other <option
value="Payroll Services"> Payroll Services <option value="PBC Tool -
Normal"> PBC Tool - Normal <option value="Personnel Records"> Personnel
Records <option value="Reporting"> Reporting <option value="Site
Utilities"> Site Utilities <option value="Transition Employees">
Transition Employees <option value="Well Being"> Well Being <option
value="Workforce Diversity"> Workforce Diversity <option value="Your
Career"> Your Career </select>

Cheers
Colin



<snip>

> About You,BCS Employee,Sales Recognition Events 
> Framework,BPFJ+,Building Wealth,Community 
> Program,Compensation,Employment Confirmations,Employee 
> Development,Employee Services,Executive Development,Expense 
> Reimbursement,Financial Benefits,Flexibility,Global Pulse 
> Survey,Health Benefits,Hiring,HR Assist,IDP Tool,Insurance,Manager 
> Services,Management Development,Mobility,New Hire 
> Information,Other,PaylinkPlus,Payroll
> Services,PBC Tool - Urgent,PBC Tool - Normal,Peace of Mind 
> Benefits,Personnel Records,Promotions,Reporting,Reporting - Data 
> Quality & Integrity,Site Utilities,Single Cycle Salary 
> Review,Transition Employees,Transactional,Well Being,When Life 
> Changes,Workforce Diversity,Workplace Practices,Your Career

</snip>



Reply via email to