Ticket #845 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

[patch][cla] FormContainer

Reported by: joose@… Owned by: dylan
Priority: normal Milestone:
Component: Widgets Version: 0.3
Severity: normal Keywords: FormContainer
Cc: joose@…

Description

This is FormContainer? widget.

Currently you create forms like this:

myContent='<form name="myForm">";
myContent+='<input type="text" name="name" value="'+obj.name'" />";
myContent+='<input type="text" id="birthday" date="'+dojo.date.format(new Date(obj.birthday),string)+'" />';
myContent+='<input type="button" onClick="myGet()" />';
myContent+='</form>'

function myGet() {
 var obj={};
 obj["name"]=dojo.byId('myForm').name.value;
 obj["birthday"]=dojo.widget.byId('birthday').datePicker.storedDate;
 ...
}

So it gets very complex and difficult when you have big and lot's of forms.

Now let's see about FormContainer?.

It's purpose is to get/set values to/from object/form. To make it work with dropdowndatepicker, you need apply patch included in ticket #721.

This helps making forms. With this you can easily create "empty" forms like this:

<form dojoType="FormContainer" id="myForm">
 <input type="text" name="name" />
 <input type="text" name="birthday" dojoType="dropdowndatepicker" />
 <input type="button" onClick="myGet()" />
</form>

Then you define object (like, get from the server):

obj.name='Joose Vettenranta';
obj.birthday='11/22/2006';

Then you just command formcontainer:

dojo.widget.byId("myForm").setValues(obj);

When button is pressed, function could be like this:

function myGet() {
  var obj=dojo.widget.byId("myForm").getValues();
  ...
}

So easy!

And now it's very easy to do RAD-style development. Someone creates form, someone creates servers get/set thignies and someone creates stuff together in dojo with formcontainer.

Attachments

formcontainer.zip (3.0 kB) - added by joose@… 3 years ago.
FormContainer?.js, test-FormContainer?.js and showposts.php
FormContainer.js (6.2 kB) - added by joose@… 3 years ago.
Fixed bugs and made it work with RepeaterContainer? and support for latest trunk syntax.

Change History

Changed 3 years ago by joose@…

FormContainer?.js, test-FormContainer?.js and showposts.php

Changed 3 years ago by dylan

  • owner changed from anonymous to dylan
  • status changed from new to assigned

Changed 3 years ago by dylan

  • summary changed from FormContainer to [patch][cla] FormContainer

Changed 3 years ago by dylan

I hate to ask, but any chance you could update to use the new widget/package syntax?

Changed 3 years ago by joose@…

Yes it might be possible. Last few days I've been working to make formcontainer work better and got it working yesturday. Unfortunally most widgets don't have setValue() or anything similar, so formcontainer currently just works for DropdownDatePicker?.. We definetly would need FormWidget? class to say that we have to have set/getValue() functions.. I'll upload new version of formcontainer soon.

Changed 3 years ago by joose@…

Fixed bugs and made it work with RepeaterContainer? and support for latest trunk syntax.

Changed 3 years ago by dylan

(In [5767]) references #845, new FormContainer? widget, needs inline documentation

Changed 3 years ago by dylan

cleaned up, and checked in.

It would be nice if we could get a patch with inline documentation for this before we get to 0.4:

http://dojo.jot.com/WikiHome/CodeCommentCompletenessTable

Changed 3 years ago by dylan

  • status changed from assigned to closed
  • resolution set to fixed

Changed 2 years ago by anonymous

  • milestone deleted

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.