trbs
10 Jul 2007, 2:56 PM
Hi all,
Here my first Ext.ux contribution :)
Updated: 12-July-2007
There is a know problem with Internet Explorer, thanks for MagicFrog for reporting this. It works on Firefox / Opera and Safari, so i'm guessing it's a bug in IE. And without decent debug tools i cannot hunt this much further. Hopefully this will disappear after working down items from the TODO list.
Ext.ux.form.ServerForm
Create's a Ext.form.Form from a server side xml definition file.
The definition file contains:
form field
submit/validation url
extra validation rules
Download
See http://ido.nl.eu.org/extdjango/ for a demo and download links.
You can view and download the Extjs code there as well as the integration code for Django.
Feel free to create your own server side class for php / java / perl / c# / etc, I'll include and/or host your server framework class with this user extension if you like.
Online Demo
Online Demo at http://ido.nl.eu.org/extdjango/
The online demo combines Django (http://www.djangoproject.com)'s great newforms (http://www.djangoproject.com/documentation/newforms/) with Ext forms. It does validation both at the client and at the server, because everybody knows that one should never ever accept information send by the client without checking it explicitly before going into the storage backend ;)
The great thing about ServerForms and the accompanying code for Django (but feel free to write something up for your own serverside framework) is that you can now have both fancy Ext forms and serverside validation without having to write the form code twice.
Todo / Future Thought
JSON Support; by adding config option: {format: 'json'} to ServerForm.
Merge with FormBuilder; http://extjs.com/forum/showthread.php?p=45577#post45577
Fieldset Support;
More Form Options;
XML Definition File
The XML Definition file would like something like this:
<?xml version="1.0" encoding="UTF-8"?>
<response success="true">
<url>/extdjango/extformsubmit/</url>
<form>
<field>
<id>firstname</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'emptyText': 'fill me in', 'fieldLabel': 'firstname', 'allowBlank': 'false', 'maxLength': 20}]]></config>
</field><field>
<id>lastname</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'emptyText': 'fill me in', 'fieldLabel': 'lastname', 'allowBlank': 'false', 'maxLength': 20}]]></config>
</field><field>
<id>company</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'vtype': 'inc', 'fieldLabel': 'company', 'allowBlank': 'false', 'vtypeText': "Must end with 'inc.' <br/><i>This is a vtypes inserted from the django (serverside) it is not part of the standard ExtJS Vtypes set.</i>", 'value': 'default inc.', 'emptyText': 'fill me in', 'vtypeFunc': 'function(v) {\n\t\treturn /^.*(inc.?)$/i.test(v);\n\t }', 'maxLength': 20}]]></config>
</field><field>
<id>email</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'vtype': 'email', 'fieldLabel': 'email', 'allowBlank': 'false'}]]></config>
</field><field>
<id>date</id>
<type>Ext.form.DateField</type>
<config><![CDATA[{'fieldLabel': 'date', 'allowBlank': 'false'}]]></config>
</field><field>
<id>enable</id>
<type>Ext.form.Checkbox</type>
<config><![CDATA[{'fieldLabel': 'enable'}]]></config>
</field>
</form>
</response>
Here my first Ext.ux contribution :)
Updated: 12-July-2007
There is a know problem with Internet Explorer, thanks for MagicFrog for reporting this. It works on Firefox / Opera and Safari, so i'm guessing it's a bug in IE. And without decent debug tools i cannot hunt this much further. Hopefully this will disappear after working down items from the TODO list.
Ext.ux.form.ServerForm
Create's a Ext.form.Form from a server side xml definition file.
The definition file contains:
form field
submit/validation url
extra validation rules
Download
See http://ido.nl.eu.org/extdjango/ for a demo and download links.
You can view and download the Extjs code there as well as the integration code for Django.
Feel free to create your own server side class for php / java / perl / c# / etc, I'll include and/or host your server framework class with this user extension if you like.
Online Demo
Online Demo at http://ido.nl.eu.org/extdjango/
The online demo combines Django (http://www.djangoproject.com)'s great newforms (http://www.djangoproject.com/documentation/newforms/) with Ext forms. It does validation both at the client and at the server, because everybody knows that one should never ever accept information send by the client without checking it explicitly before going into the storage backend ;)
The great thing about ServerForms and the accompanying code for Django (but feel free to write something up for your own serverside framework) is that you can now have both fancy Ext forms and serverside validation without having to write the form code twice.
Todo / Future Thought
JSON Support; by adding config option: {format: 'json'} to ServerForm.
Merge with FormBuilder; http://extjs.com/forum/showthread.php?p=45577#post45577
Fieldset Support;
More Form Options;
XML Definition File
The XML Definition file would like something like this:
<?xml version="1.0" encoding="UTF-8"?>
<response success="true">
<url>/extdjango/extformsubmit/</url>
<form>
<field>
<id>firstname</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'emptyText': 'fill me in', 'fieldLabel': 'firstname', 'allowBlank': 'false', 'maxLength': 20}]]></config>
</field><field>
<id>lastname</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'emptyText': 'fill me in', 'fieldLabel': 'lastname', 'allowBlank': 'false', 'maxLength': 20}]]></config>
</field><field>
<id>company</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'vtype': 'inc', 'fieldLabel': 'company', 'allowBlank': 'false', 'vtypeText': "Must end with 'inc.' <br/><i>This is a vtypes inserted from the django (serverside) it is not part of the standard ExtJS Vtypes set.</i>", 'value': 'default inc.', 'emptyText': 'fill me in', 'vtypeFunc': 'function(v) {\n\t\treturn /^.*(inc.?)$/i.test(v);\n\t }', 'maxLength': 20}]]></config>
</field><field>
<id>email</id>
<type>Ext.form.TextField</type>
<config><![CDATA[{'vtype': 'email', 'fieldLabel': 'email', 'allowBlank': 'false'}]]></config>
</field><field>
<id>date</id>
<type>Ext.form.DateField</type>
<config><![CDATA[{'fieldLabel': 'date', 'allowBlank': 'false'}]]></config>
</field><field>
<id>enable</id>
<type>Ext.form.Checkbox</type>
<config><![CDATA[{'fieldLabel': 'enable'}]]></config>
</field>
</form>
</response>