Friday, May 28, 2010

Plan to crush #1318

Goal: Get a new repeat tag working, the new repeat tag should incorporate jquery with the formentry module

Sub Goal:
1) Get new repeat tag display functioning
the general move is use jquery to clone and insert the new row of html control , to work this out,
we need to consider how to copy and insert all html controls with in a repeat tag


2)Get new repeat tag submit functioning
the module use a hashmap to store the {widget : htmlcontrol} name pair. The problem is when a new html controller has been generated by jquery/javascript, the module has no way to know about their existence.

The possible flow:

Form Creation
1) user edit a form, a tag

2)user submit/save/edit the form

Form Preview()
the html form is generated by createForm in formentrysession
we can handle the tag in line 247: applyTags function
The applyTagsHelper will do the job.
so
1) add a entry in the applicationContext.xml to relate with a handler
2)Create a new handler

the handler is used for generate required jquery/html for the newrepeat tag

input:

< newrepeat >
< template >
< obs conceptid = "123" >
< /template >
< /newrepeat >

Output(Mode = view):

< script .... the javascript/jquery to clone and insert the template >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

Form Enter
To handle new repeat tag enter(save), 2 things needs to be done:
1) mapping a repeated widget with a htmlid

input Original:

< newrepeat >
< template >
< obs conceptid = "123" >
< /template >
< /newrepeat >

input intermidate:


Output(Mode = edit):

< script .... the javascript/jquery to clone and insert the template >
< span any exsiting obs that are associated with this encounter >
...
< /span >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

Output(Mode = input):

< script .... the javascript/jquery to clone and insert the template >
< span ... the template html generated based on concept with id="123" >
....
< /span >

< span ... 1 generated html on concept with id="123" >
....
< /span >

No comments:

Post a Comment