Hi,
I have been working with the javascript functionality within the screen files and have come across a problem. When specifying the structure of a single label/field row you can use the following:
$structure['main']['fields'][]
= array('tracker_stop' => 'Stop Time',
'javascript' => array(
'id'=>'tracker_stop_row'));
I get the XML and HTML that I expect
<row id="tracker_stop_row">
<cell label="Stop Time"/>
<cell field="tracker_stop"/>
</row>
<tr id="tracker_stop_row">
<td class="label"><span class="required">* </span>Stop Time</td>
<td>
<input name="tracker_stop" class="text" type="text" value="" maxlength="20" size="20" />
</td>
</tr>
When I try and to use the multiple cells in a row it does not work. I've traced it to the setScreenStructure(...) function and it happens when testing if the row data is a string or not a string.
Essentially what happens is the logic causes it to jump into processing of arrays or processing key/value pairs and never switches back to handle the correct type.
My screen structure:
$structure['main']['fields'][1] = array('javascript' => array('id'=>'tracker_start_row'));
$structure['main']['fields'][1][] = array('label' => 'Date');
$structure['main']['fields'][1][] = array('field' => 'tracker_start');
$structure['main']['fields'][1][] = array('label' => 'Time');
$structure['main']['fields'][1][] = array('field' => 'tracker_start');
Resulting XML:
<row id="tracker_start_row">
<cell label="Array"/>
<cell field="null"/>
<cell label="Array"/>
<cell field="1"/>
<cell label="Array"/>
<cell field="2"/>
<cell label="Array"/>
<cell field="3"/>
</row>
All of this because the need to have the id attribute in the <tr> tag!
I don't have a fix for this code as I'm not sure if there is another way around the problem. Any ideas on that?
Suggested fix would be to unwind the logic so that every inner row is tested for array/string and then apply the logic for building the specific xml data.
Cheers,
Kyle Brost
----
www.softelephant.com