[TYPO3-project-formidable] majix, how to combine multiple clientData values

Alexander Rose alexander.rose at weirdbyte.de
Wed Nov 21 19:22:00 CET 2007


Hi,

Am 21.11.2007 um 14:25 schrieb Jerome Schneider:

> Hi Alexander,
>
> the best solution when it comes to compute client input data is to use
> the ajax events.
Sorry, I haven't been precise. I want to do it on the clientside with  
runat="client". It's really just a multiplication, which most clients  
- i hope so - are capable of. anyway thanks for your effort.

I added some lines in api/base/rdt_box/res/js/box.js:

I changed the setHtml and the setValue methods

     setHtml: function(sHtml) {
       if(typeof(sHtml)=="object"){
	this.domNode().innerHTML = eval(sHtml[0]+sHtml[2]+sHtml[1]);
       } else {
	this.domNode().innerHTML = sHtml;
       }
     }

and the setValue similarly.

Now majixSetHtml, majixSetValue and majixReplaceData accept an array  
with three entries as params:
e.g. 1 and 2 are values and 3 is an infix method.

<renderlet:TEXT name="field_a" label="field a" />
<renderlet:TEXT name="field_b" label="field b" />
<renderlet:BOX name="box_results" mode="h2" />
<renderlet:BUTTON name="btn_multiply" label="Multiply">
	<onclick runat="client" params="field_a, field_b">
		<userobj>
			<php><![CDATA[
				
	$aParams = $this->oMajixEvent->getParams();

	$iA = "clientData::field_a";
	$iB = "clientData::field_b";
	$iInfix = "*";

	return $this->aORenderlets["box_results"]->majixSetHtml(array($iA, 
$iB,$iInfix));
				
			]]></php>
		</userobj>
	</onclick>
</renderlet:BUTTON>

It works for me, now. It would be be nice to have something more  
general, e.g. you give a string with 'templated' javascript in it and  
an array with clientData 'references' to majixReplaceData. then the  
placeholders in the 'templated' js are replaced with the clientData  
references and a static script can be generated. what do you think?


alex


More information about the TYPO3-project-formidable mailing list