0.2b and newer versions?

1 view
Skip to first unread message

unomi

unread,
Sep 23, 2008, 4:19:36 AM9/23/08
to inputex
Ming mentioned something about 0.2b version, where can i get my dirty
hands on it?

neyric

unread,
Sep 23, 2008, 4:33:27 AM9/23/08
to inputex
You can checkout the SVN repository: version 0.2b is in the one
currently in the trunk.
(see instructions at http://code.google.com/p/inputex/source/checkout)

It is very close to 0.2.0 now (only a few tickets left :
http://code.google.com/p/inputex/issues/list?can=2&q=&sort=milestone&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary
)

unomi

unread,
Sep 23, 2008, 4:49:38 AM9/23/08
to inputex
very nice :)
I am wondering if you have / will support building select fields
dynamically(runtime) from ajax?
I am in the process of bolting something on the 0.1 one..
usage something like this:

new inputEx.Form( {
fields: [
{label: 'Title', type: 'select'
, inputParams: {
name: 'title',
selectJSON: "/AJAJ_db-update.php?
ajaxObj=dropdown&ajaxAction=populate&"+"mTable=basecode&mField=basetype&mValue=DGR&rValue=BaseRecID&rText=LabelText"
},
},
{label: 'Firstname', inputParams: {name: 'firstname', required:
true, value:'Jacques' } },
{label: 'Lastname', inputParams: {name: 'lastname',
value:'Dupont' } }
],


Field.js:
inputEx.SelectField.prototype.AJAXpopulateJSON= function()
{
if (YAHOO.lang.isString(this.options.selectJSON)) {
var url = this.options.selectJSON;
var ds = new YAHOO.util.DataSource(url);
ds.responseType = YAHOO.util.DataSource.TYPE_JSON;
ds.responseSchema = {
fields: ['value', 'text'],
resultsList: 'data'
};
ds.connMethodPost = true;
ds.sendRequest(''
,function(sRequest, oResponse) {
this.options.selectJSON = oResponse.results;
this.fireUpdatedEvt();
//this.renderComponent;
//need to redraw the element when the data becomes available.
// ??
}
,this
);
}
}


inputEx.SelectField.prototype.renderComponent = function() {

this.el = inputEx.cn('select', {name: this.options.name || ''});

if (this.options.selectJSON)
{ if (YAHOO.lang.isString(this.options.selectJSON) )
{this.AJAXpopulateJSON(this.options.selectJSON,this);}

this.options.selectValues=[];this.options.selectOptions=[];
for (var i=0 ; i < this.options.selectJSON.length; i++ )
{
this.options.selectValues[i] = this.options.selectJSON[i].value;
this.options.selectOptions[i] = this.options.selectJSON[i].text;
}
}

...



Sorry if this is already hiding in there somewhere..

The problem that I am facing is that the ajax doesnt get back untill
the field is rendered, and I dont see a way to re-render it?

Any assistance will be greatly appreciated

Eric Abouaf

unread,
Sep 23, 2008, 5:38:38 AM9/23/08
to inp...@googlegroups.com
Good idea !
Maybe it is worth relying on the Datasource component for the SelectField ? (which is already used in the autocompleter).
(instead of passing selectOptions and selectValues, we just pass a Datasource instance to the select field)

It includes many convenient features: getting data from ajax, static arrays or returned by a function, cache, etc...
We'll also need methods to repopulate the SelectField with new items.

PS: Your code should work with 0.2b. The 'label' attribute has moved into the 'inputParams' object.
       You might also be interested in the "interactions" example. You may want to trigger the ajax request this way...

unomi

unread,
Sep 23, 2008, 7:43:59 PM9/23/08
to inputex
Not really sure what happened to my first reply to this one..

On Sep 23, 4:38 pm, "Eric Abouaf" <eric.abo...@gmail.com> wrote:
> Good idea !
> Maybe it is worth relying on the Datasource component for the SelectField ?
> (which is already used in the autocompleter).
> (instead of passing selectOptions and selectValues, we just pass a
> Datasource instance to the select field)
>
> It includes many convenient features: getting data from ajax, static arrays
> or returned by a function, cache, etc...

I would say that having a persistant (and dynamically changeable)
datamodel from which to rebuild the form would be an excellent way
forwards. For noobs (like me) the first A in AJAX can be pretty
confusing to deal with in a consistent way and components/widgets
would have to come up with interfaces to cater to runtime changes in
order to stay viable.


> We'll also need methods to repopulate the SelectField with new items.


Using an underlying DataSource from which one can 'render' the form on
demand seems to solve alot of issues.



Eric Abouaf

unread,
Sep 24, 2008, 3:35:31 AM9/24/08
to inp...@googlegroups.com
Yes. I'll definitely try do that while supporting the old options...
Thank you for this great suggestion.
Reply all
Reply to author
Forward
0 new messages