 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
Zorgh
Joined: 28 Jan 2007 Posts: 1
|
Posted: Sun Jan 28, 2007 11:10 pm Post subject: HTML_QuickForm and dojo : datepicker & many other widget |
|
|
I just wanted to communicate one of my latest discoveries, which shows that HTML_QuickForm and Dojo mix up truly easily.
This way you can take advantage of many widgets provided by dojo (Date picker, time picker, HTML Editor ...), as well as client side validations :
Exemple :
Put this in the header :
| Code: |
<script type="text/javascript" src="PathToDojo/dojo.js"></script>
<script type="text/javascript">
dojo.require("dojo.widget.DropdownDatePicker");
dojo.require("dojo.widget.validate");
</script>
|
And now for the actual code :
A running drop-down date picker in three lines !
| Code: |
$element = new HTML_QuickForm_text(”DateField”, “Enter a date”);
//This is the only required line in order to transform the text field into a date picker.
$element->setAttribute(”dojoType”, “dropdowndatepicker”);
$quickForm->addElement($element);
|
I did not think it could be *that* simple. I discovered Dojo today, and I think I will love it.
A more advanced example below :
Let’s assume you want to verify that an entry is of type “time” :
| Code: |
$element = new HTML_QuickForm_text(”Time”, “Enter a time”);
$element->setAttribute(”dojoType”, “TimeTextBox”);
$element->setAttribute(”trim”, “true”);
$element->setAttribute(”format”, “HH:mm:ss”);
$element->setAttribute(”invalidMessage”, “Invalid time format (correct format is hh:mm:ss)”);
|
Your comments are welcome.
Dojo can be found at : http://dojotoolkit.org/
(look at the "Form Widgets" category, in the demo section)
[/url] |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1173
|
Posted: Mon Jan 29, 2007 1:02 am Post subject: |
|
|
Thanks for mentioning Dojo here -- I didn't knew it before. The ComboBox element is interesting.
I would like your datepicker example more, if it would use QF's date element together with the Dojo datepicker, but that might require some more work. I'm using QF's date element with jscalendar, which is also a nice combination. |
|
| Back to top |
|
 |
c.lauziere
Joined: 24 Apr 2007 Posts: 5
|
Posted: Mon Jul 09, 2007 1:32 am Post subject: Using HTML_Ajax and Dojo ?? |
|
|
Hi,
Any of you by luck have been able to work with HTML_Ajax and dojo at the same time?
I have a form that's called with the Ajax libraries with a DatePicker (dojo widget) in it. And it does not work.. there must be conflicts with the javascript I suspect ...
Any advise ?
Thanks _________________ Server info:
PEAR Version: 1.5.2
PHP Version: 5.2.0
Zend Engine Version: 2.2.0
FreeBSD 6.1-RELEASE
Christopher Lauzière |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|