All -

I was following the instructions here on defining new input types for Semantic 
Forms:

http://www.mediawiki.org/wiki/Extension:Semantic_Forms/Defining_new_inputs

Those instructions state:

"...This function needs to return an array of two elements: the first is the 
HTML text that will be displayed on the page for this input, and the second is 
whatever Javascript text should be added at the top of the page to enable both 
this input's running and its validation (this value can be null)."

Users reported issues where they would sometimes see the word "Array" pop up in 
place of the form field, which led me to put some debug statements into 
Semantic Forms to figure out what was happening (after ensuring that I was, in 
fact, returning what the docs said to return) - according to my debug 
statements, returning an array from the function in question is NOT correct.  
Every other return value I saw coming out of that function contained only the 
HTML for the form field, not an array with two elements (and I was doing a 
print_r, so that hopefully would've caught any actual array value returns).

I would note, though, that the array() return value worked in some cases but 
not others - if I kept the return value of the function as:

return array($html, null);

where $html is non-empty, the field would function for me across several 
computers, browser sessions, etc., but other users reported the same "Array" 
statement sometimes being printed.  However, replacing that with:

return $html;

appears to work everywhere.

I wanted to flag this, since it seems like an inaccuracy in the documentation 
itself (if it's not some sort of strange processing bug with Semantic Forms) - 
once I changed the code to only return the HTML, my test user stopped reporting 
the issue.  This was with Semantic Forms 2.1.2.  Is what I observed actually 
what should be happening?
__________________________________________________ 
Peter Ellis 
Scientist 
Knowledge Discovery and Informatics
Pacific Northwest National Laboratory


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to