You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by "Hans C. Poo" <ha...@welinux.cl> on 2011/07/13 19:15:22 UTC

Initialisation of dynamic added date fields

Hi,

We are building a very dynamic data entry system that requires adding fields on the fly.

Specially we have some sections we are calling "grid".

Each row of these grids is a set of fields that replicate from the fields of row zero, there is a button to add new rows.

Initially we used some jquery to clone rows, rename fields, and worked fine, but the initialisation of dateFields was missing, we are mounting all the application on click fields and eventually other controls may get broken too, at this time we considered  to manually call the javascript binding code of the dateField, but we considered it too obtrusive, and decided to resource to Ajax and created a handler that only returned one row at a time, velocity code:

$imports

<tr>
	#foreach( $field in $fields )
		<td>$field</td>
	#end
</tr>

Then we included in the response the $imports, and in fact the javascript code for the dateField was there but with a lot o baggage, and were too much and the page loose the format.

Finally we agree that we need only the javascript initialisation (binding) code of the dateField: Event.observer ..., it wasn't possible because but it was inside the protected method addCalendarOptions(..).

We don't want to broke the API or begin to clone javascript code, is there a way to accomplish this in some more standard way.

Note: Due to the nature of the system we were not able to use FormTable, that was the most similar thing we found on apache click space.

Thanks
Hans