Hey folks,
I know there have been several posts out there about using valid_input within the TAG_INFO section of a WFT. These have all dealt with using single values though. wondering if someone can provide some insight as to how to get at multiple values out of a set of fields...I am trying to validate file names contained in a table of text fields against filenames already on the system...having trouble getting the subroutine in the valid_input definition to take the values contained in the text fields defined by the html definition.
here is the TAG_INFO:
TAG_INFO (
new_core_product=>[
html=>"<table style='display:none;' id='new_core_product_table'><THEAD>".
"<tr><th class='iw-base-text-field-label'><b>Product Expanded Name</b></th>".
"<th class='iw-base-text-field-label'><b>Product Type</b></th>".
"<th class='iw-base-text-field-label'><a href=\"JavaScript:addTableRow('new_core_product_table','');\" style='vertical-align:top;'>Add Row</a> <a href=\"JavaScript:deleteRow('new_core_product_table');\">Delete Row</a></th>".
"</tr></THEAD><tbody><tr><td><input type='text' id='product_expanded_name' name='product_expanded_name'></td>".
"<td><select name='product_type' id='product_type'><option value='' selected='t'> - Select - </option></select></td></tr></tbody></table>",
label=>"<div id='new_core_product_table_label' style='display:none;'>Add new core products.</div>",
is_required=>"false",
],
);
and the subroutine:
sub checkProdName($) {
my
@prodNameList =
@_;
my $validationResult = 0;
my $checkResultSum = 0;
my $startDir = "/productDirectory";
foreach my $prodName (
@prodNameList) {
my $result = SWOTDCTUtils::validate_core_prod_name($prodName,$startDir);
$checkResultSum += $result;
}
if ($checkResultSum == 0) {
$validationResult = 1;
}
return $validationResult;
}
The module method just takes the name and checks recursively to see if a file that matches that name exists in $startDir. I have tested that stand alone and it is working. Trouble I am having is getting this subroutine to take the potentially multiple values coming from the TAG_INFO. Notice that there is a single set of fields defined in the html definition to start, but the Java Script functions there add additional sets of fields for adding multiple product names (read: file names). The addition of the fields is also working fine and I am able to process all the values submitted as part of the instantiation of a job (files of the correct names get created) but I can't get this valid input piece to work...
Any advice would be great...
Thanks,
Brian