Forum OpenACS Q&A: Re: xowiki Folder Object

Collapse
14: Re: xowiki Folder Object (response to 12)
Posted by Gustaf Neumann on
I see, you want to configure xinha for a certain form_field via the form constraints. Since in the form-constraints the fields are separated via comma, these have to be coded as __COMMA__. The following should work:

{_text:richtext,editor=xinha,javascript=
xinha_config.toolbar = [
    ['popupeditor'__COMMA__ 'bold'__COMMA__'italic'__COMMA__'createlink'__COMMA__'insertimage'__COMMA__'separator']__COMMA__
    ['killword'__COMMA__'removeformat']
  ];
}
Collapse
15: Re: xowiki Folder Object (response to 14)
Posted by Richard Hamilton on
Gustaf,

Thank you for the reply. The __COMMA__ substitution is extremely helpful thankyou.

For the sake of completeness I wanted to let you know that the above proposed notation (i.e. with square brackets) does not in fact work because the '[' and ']' fail the form validation checks in xowiki.

However, this notation works:

{main_page_content:richtext,editor=xinha,label=Content,plugins=Stylist OacsFs,javascript=xinha_config.toolbar=new Array(new Array('popupeditor')__COMMA__new Array('separator'__COMMA__'textindicator'));}

This is exactly what I wanted to achieve, however it still pains me that I cannot work out why the more general widgetspec parameter specification method doesn't work for me.

Regards
Richard

Collapse
16: Re: xowiki Folder Object (response to 15)
Posted by Gustaf Neumann on
glad, that this works. The form constraints are obviously not the best way to pass javascript. On the longer range, we should find a better way of providing these. The formfields contain already a "slim" configuration for xinha, and the way should be to extend this further.

Concerning square brackets for javascript arrays: i have tested the example above (14) before posting, and it works nicely.

Collapse
17: Re: xowiki Folder Object (response to 16)
Posted by Richard Hamilton on
Gustaf,

That is strange. I have just tried this again by creating a test form with a single field on it. I have copied your code from the forum post and I receive this error:

Error in field Form Constraints: Form constraint contains invalid characters

Could it be that the form validation on my setup is different for some reason? Is your form validation set to the default?

Content:  @test_var@

Form:  <form>@test_var@</form>

Form Constraints:  {test_var:richtext,editor=xinha,javascript=
xinha_config.toolbar = [
    ['popupeditor'__COMMA__ 'bold'__COMMA__'italic'__COMMA__'createlink'__COMMA__'insertimage'__COMMA__'separator']__COMMA__
    ['killword'__COMMA__'removeformat']
  ];
}

Regards
Richard

Collapse
18: Re: xowiki Folder Object (response to 17)
Posted by Gustaf Neumann on
you are right, it should complain, but does not on my local machine... i have always a lot of experimental code hanging around, so there must be somewhere a bad interaction...
-gustaf
Collapse
19: Re: xowiki Folder Object (response to 16)
Posted by Richard Hamilton on
I was just today re-visiting my confusion on this issue. I think I finally understand that the Xowiki instance 'Xinha WidgetSpec' parameter only configures Xinha for the forms used to create or edit xowiki objects.

I now finally understand that adding a xinha config to a formfield spec is the only way currently to configure the editor for Xowiki.Form fields.

In my current experiment, where I have several textarea fields that all need xinha activated with the same configuration, this is very verbose and repetitive.

It would be great to have the ability to set a default spec for xinha for use when filling-out/ creating instances of Xowiki.Forms.

regards
Richard

Collapse
20: Re: xowiki Folder Object (response to 19)
Posted by Richard Hamilton on