[dojo-contributors] Form and Repeater

Joose Vettenranta joose.vettenranta at kompassi.fi
Tue Aug 7 05:00:05 EDT 2007


Hello,

I'm the guy behind the infamous Form and Repater from 0.4.x tree.  
Currently I'm thinking of going to try 0.9 by going to port Form and  
Repeater to 0.9. According to ppl on IRC there have been some work on  
Repeater and Form already and I would like to give a helping hand.

Repeater:
Idea is simple: easy to way to add/remove/change position of rows.  
Here are few pointers why I did something the way I did it:
- regexping names and changing them according to the row of the  
RepeaterRow: if doing regular submit, then you have to know the order  
of the rows (if you need to know the order)
- binding custom actions to rows: allows you to create iTunes  
smartplaylist kind of lists where selecting A changes options of  
select B etc...
- DnD Move: usuability
- DnD Destroy: usuability
- rowActions: easy to code stuff.. like delete row button

This is what I had in mind (for 0.4.x) for Repeater:
- making RepeaterRow as widget (it is) and using templateString  
instead of custom parser. Then developer can use dojoAttachPoints to  
make it's own connections, like:

var row=repeater.addRow();
dojo.event.connect(row.myAttachPoint1, "onclick", ...);
dojo.event.connect(row.myAttachPoint2, "onchange", ...);

Form:
Idea is that developer can take empty form and just do form.setValues 
(myValues) to set values and form.getValues() to get values. Of  
course this would be easy if just handling regular form-fields but  
widgets needed to be included and after that validation. And also,  
current form.getValues() returns object which might have objects as  
childs.. like:

{foo: {bar: "quux"}} would referer to <input name="foo.bar"  
value="quux" />

Idea behind this is that you can easily map XML-presentation of an  
object to form, say like this:
<productGroup>
  <name>Foo Ltd</name>
  <products>
   <product><name>Bar</name></product>
   <product><name>Bar</name></product>
   <product><name>Bar</name></product>
   <product><name>Bar</name></product>
  </products>
</productGroup>

so converting that XML to JSON would be like:
{name: "Foo Ltd", products: [{name: "Bar"}, {...},...}]}

of course after the Form it would be clear that also Repeater -widget  
is required. So I created it. So in example above, I'd use Repeater  
to add new products to product group (or delete). Form adds new rows  
to Repeater and gets values from Repeater.

Repeater doesn't have getValues() because it does not need it and it  
does not have setValues() because that is so easy to implement in Form.

But I would like to hear what you have thought of Form and Repeater  
and what should we do about them?

If you have wondered why I have not been in dojo mettings in IRC, is  
that it happens to be at 01:00 in my timezone =)

- Joose

--
Joose Vettenranta, CEO / Partner, Ohjelmistotalo Kompassi Oy
E-Mail: joose.vettenranta at kompassi.fi
GSM: +358 44 561 0270
WWW: http://www.kompassi.fi/



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-contributors/attachments/20070807/c49bbec7/attachment.htm 


More information about the dojo-contributors mailing list