Ticket #549 (closed enhancement: fixed)

Opened 4 months ago

Last modified 1 month ago

jForms: support of <group>

Reported by: doubleface Assigned to: laurentj
Priority: normal Milestone: Jelix 1.1 beta 1
Component: jelix:forms Version: trunk
Severity: normal Keywords:
Cc: Php version:
Review: Hosting Provider:
Documentation needed: 1 Blocking:

Description

Wouldn't it be interesting to be able to define groups in jforms. These groups would be translated to fieldsets.

I know we can do that in the template, but I think this would be interesting for generic controllers like jDaoCrud for example.

I am also also doing a generic controller for my work and I must create templates for each objects only to specify how data will be grouped in fieldsets.

What do you all think about it ?

Change History

(follow-up: ↓ 2 ) 04/21/08 14:41:44 changed by laurentj

No problem if you propose a solution for templates : how can we generate this fieldset ? For the moment, we cannot because formcontrols loops over all controls.. Suggest some new template plugins.

(in reply to: ↑ 1 ) 04/23/08 18:07:53 changed by doubleface

Replying to laurentj:

Suggest some new template plugins.

Well, I will try to find something usable in templates...

(follow-up: ↓ 4 ) 04/26/08 17:00:14 changed by laurentj

  • owner set to laurentj.
  • status changed from new to assigned.
  • milestone set to Jelix 1.1 beta 1.

It's OK, I think how to do it. The same mecanism could be used for other future tags like <switch>, <repeat> etc..

I'm going to develop it, I need it for jbugTracker

(in reply to: ↑ 3 ) 04/26/08 18:06:31 changed by doubleface

Replying to laurentj:

It's OK, I think how to do it. The same mecanism could be used for other future tags like <switch>, <repeat> etc.. I'm going to develop it, I need it for jbugTracker

OK, was digging in jForms, and I am glad you have an idea how to do it !

04/28/08 15:28:53 changed by laurentj

  • summary changed from Fieldsets in jForms to jForms: support of <group>.

05/02/08 16:36:25 changed by laurentj

The syntax of group tag will be:

<group ref="foo">
    <label>The label of the group </label>

    <!-- all controls of the group -->
    <input .../>
    <othercontrol .../>
    ...
</group>

If we deactivate the group or if we mark it as readonly, all its controls will be deactivated or readonly.

For the template part :

If the control is displayed throw a formcontrols loop or by formfull, it will generate a default html content like this:

<fieldset><legend>The label of the group</legend>
<table>
<tr><th><label>....here the label of the first control</th>
    <td>here the first control</td></tr>
etc.
</table>
</fieldset>

If we want to personnalize the output, we would use the form_control_group plugin. Example which generate the same content as the default html generation like above:

    {form_control_group 'ref_of_control', '<fieldset><legend>%s</legend><table>', '</table></fieldset>'}
      <tr><th>{ctrl_label}</th><td>{ctrl_control}</td>
    {/form_control_group}

this plugin loops over all child controls of the group. The second and third argument are the content before and after the list of controls. "%s" is replaced by the label of the group.

All comments are welcomed.

05/02/08 17:09:51 changed by bballizlife

I'm ok with that proposal as template plugins allow us to personnalize the output as we want. I also relly like the concept of inheritance of readonly and deactivate attributes.

05/31/08 01:33:48 changed by laurentj

It works on the experimental/jforms-group branch. I still have to create the form_control_group plugin.

07/20/08 00:11:58 changed by laurentj

  • status changed from assigned to closed.
  • resolution set to fixed.

landed into the trunk.

07/20/08 01:14:11 changed by laurentj

  • docneeded set to 1.
Download in other formats: Comma-delimited Text Tab-delimited Text RSS Feed