Colin Johnstone wrote:
> 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/&/&/g;
> $data =~ s/</</g;
> $data =~ s/>/>/g;
> $data =~ s/'/'/g;
> $data =~ s/"/"/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 & Integrity">
> Reporting - Data
> Quality & 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>
Something's fishy. That code could not possibly have produced that output.
You add an option with:
$optionHTML .= qq[<option label="$subject" />];
But your output lines look like:
<option value="BCS Employee"> BCS Employee
When they should look like (according to the code above):
<option label="BCS Employee" />
Perhaps you're not running the code you *think* you're running...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>