Fast Uncompromising Discussions. FUDforum will get your users talking.
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 <cell label="Stop Time"/> <cell field="tracker_stop"/> * Stop Time 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: <cell label="Array"/> <cell field="null"/> <cell label="Array"/> <cell field="1"/> <cell label="Array"/> <cell field="2"/> <cell label="Array"/> <cell field="3"/> All of this because the need to have the id attribute in the 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
Arg... All that typing for nothing... Figured it out! I needed to change the screen file from: $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'); To: $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'); Needed to change the javascript from being a key/array pair to a array/array pair. Might want to add this one to the FAQ if it's not already there. Cheers, Kyle Brost ----
Thanks for the tip. I shall add it to my documenation.