Ferruccio Zamuner schrieb:
Hello,
I'm trying to resume HTML::FormFu::Dojo from svn, it's old and it was
not working anymore:
- dojo has changed since last release
- html::formfu has improved too
I've fixed DropdownDatePicker and at least it's rendering now pass the
test and I've started to fix also Editor2 element,
but there are some things about html::formfu that I don't understand:
1) in render() it created an hash with some keys like javascript to
use in string() to stringify element.
Which is the hash key where to store xhtml rendered?
2) I like dojo (http://www.dojotoolkit.org/) for its declarative way
to describe widgets like:
<div dojoType="dijit.form.Button" label="foo">
<script type="dojo/method" event="onClick">
// some jascript code to handle click event on foo button.
</script>
</div>
<input dojoType="dijit.form.ValidationTextBox" size="30" name="bar"
required="true" invalidMessage="You need to fill this field"
promptMessage="This is the bar field" />
To make this happen I need to write some javascript in page head:
<!-- the init part -->
<script type="text/javascript">
var djConfig={ parseOnLoad: true };
</script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js">
</script>
<!-- end init part -->
<!-- the variable part for each kind of widget I need -->
<script type="text/javascript">
dojo.require('dijit.form.Button');
dojo.require('dijit.form.ValidationTextBox');
</script>
<!-- end of variable part -->
Can I introduce another %render key for render the variable part?
3) the old HTML::FormFu::Dojo is quite old and it makes some trouble
using programmatic inline javascript creation of widget:
when the browser parses them, some part of dojo may be in loading
phase yet and not ready.
But programmatic creation of dojo widgets may be wanted (for
validation issues for example) then it could be fine to make it
possible placing a <script> section just at the end of the page body:
...
<script type="text/javascript">
dojo.addOnLoad(function () {
var foo_button = new dijit.form.Button({label: 'foo'},
dojo.query('someCssSelectorHere'), 'after');
// ... some code about foo_button handling
var bar_input = new dijit.form.ValidationTextBox({name: 'bar',
required: true, promptMessage: 'bar field'},
dojo.query('someOtherCssSelectorHere', 'after');
});
</script>
</body>
I suppose that it requires another key in the render hash too for
delayed javascript insertion at end of the page, isn't it?
4) some dojo widgets are for layout only and they have not any form
field element like dijit.TitlePane but they have children elements
that can be form fields (dojox.widget.wizard for example), some other
like dijit.form.ValidationTextBox are field and we need to
html::formfu to process them. I suppose that a process() function in
elements with field can be enough to handle them.
Isn't it?
5) Another power of dojo is that it permits to define quite easy some
custom and compound widgets, but they can be useless if
html::formfu don't permit to declare them easly.
Is there any quick guide about hot to write brand new html::formfu
elements?
Hi Ferruccio,
in the HTML::FormFu::ExtJS tree we also faced some of this problems. We
decided to make it working without (almost I think) touching the
HTML::FormFu code itself.
So layout elements have been defined under our branch as
HTML::FormFu::Element::ExtJS::Panel and can be used if this distribution
is installed.
Maybe you can copy some of the design for the DOJO stuff.
Greets,
Mario
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu