You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2004/03/25 16:22:04 UTC

[CForms] adding a row to a JS property list array

Hi All

Its not actually CForms, I am still using Woody in Cocoon-2.1.4


I have this JavaScript Property List as my Form Model:

  {
	id: [unique id of the query]
	name: [what the user calls this saved query]
	type: [fulltext|advanced|keyword (etc)],
	bool: [and|or|not],
	paging: {
		size: [how many results to show],
		page: [most recently viewed page],
		total: [the # of results during last usage],
	},
	criteria: [
		{
			field: [fieldname|any],
			match: [contains|somewords|equals]
			value: [query string]
		}
		. . .
	]
}

The 'criteria' is an Array of criterion properties.
I am trying to use these in a wd:repeater with an 'add-row' 
wd:repeater-action.

I have it in a state where I can add and remove criterion(s) but am 
unable to save the form. The binding does not work, because I do not 
know what to put inside the wb:on-insert-row in the binding.

There seem to be two choices wb:insert-node and wb:insert-bean, neither 
of which appear to be appropriate to JavaScript Property Lists.

Is it possible to support JavaScript Property Lists in this way?

Is there another way of doing this, or should I move my Model to a real 
Java Bean ?


Thanks for any suggestions

regards Jeremy


Re: [CForms] adding a row to a JS property list array

Posted by Marc Portier <mp...@outerthought.org>.
you should be able to use the <wb:javascript> binding, no?

note: it should however completely replace your <wb:repeater> binding 
and manage the add/delete yourself in there

HTH,
-marc=

Jeremy Quinn wrote:

> Hi All
> 
> Its not actually CForms, I am still using Woody in Cocoon-2.1.4
> 
> 
> I have this JavaScript Property List as my Form Model:
> 
>  {
>     id: [unique id of the query]
>     name: [what the user calls this saved query]
>     type: [fulltext|advanced|keyword (etc)],
>     bool: [and|or|not],
>     paging: {
>         size: [how many results to show],
>         page: [most recently viewed page],
>         total: [the # of results during last usage],
>     },
>     criteria: [
>         {
>             field: [fieldname|any],
>             match: [contains|somewords|equals]
>             value: [query string]
>         }
>         . . .
>     ]
> }
> 
> The 'criteria' is an Array of criterion properties.
> I am trying to use these in a wd:repeater with an 'add-row' 
> wd:repeater-action.
> 
> I have it in a state where I can add and remove criterion(s) but am 
> unable to save the form. The binding does not work, because I do not 
> know what to put inside the wb:on-insert-row in the binding.
> 
> There seem to be two choices wb:insert-node and wb:insert-bean, neither 
> of which appear to be appropriate to JavaScript Property Lists.
> 
> Is it possible to support JavaScript Property Lists in this way?
> 
> Is there another way of doing this, or should I move my Model to a real 
> Java Bean ?
> 
> 
> Thanks for any suggestions
> 
> regards Jeremy
> 

-- 
Marc Portier                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at                http://blogs.cocoondev.org/mpo/
mpo@outerthought.org                              mpo@apache.org