Opened 13 years ago

Closed 11 years ago

#429 closed enhancement (wontfix)

Form condition registry

Reported by: anonymous Owned by: Nathan Toone
Priority: high Milestone: 1.3
Component: Dojox Version: 0.2
Keywords: Form management Cc:
Blocked By: Blocking:

Description (last modified by dylan)

I would like to have a framework which can manage a forms state, useful in complex forms management. You provide a name a function or object that provides the condition and then based on the condition add handlers to success and failure. An example which would suite me would be the selection of a radio button hides some form elements and shows others, the more complex situ would be different elements of a drop down box would have a different effect on different parts of the form.

An example of how I was trying to tackle the hide/show was this:

function SetControls?(that){

var ControlArray? = byClass(that.target.id, byId('the_form'));

for(x = 0; x < ControlArray?.length; x++){

var ConrolToChange? = ControlArray?[x];

var ControlClassesArray? = KMI.common.getClassNameArray(ConrolToChange?);

if(!KMI.BasicInformation?.CheckControlInfluences?(ControlClassesArray?, that.target)){

if(ConrolToChange?.style.display == 'inline'){

ConrolToChange?.style.display = 'none';

}else if(ConrolToChange?.style.display == 'none'){

ConrolToChange?.style.display = 'inline';

}

if(ConrolToChange?.style.visible == 'hidden'){

ConrolToChange?.style.display = 'visible';

}else if(ConrolToChange?.style.display == 'visible'){

ConrolToChange?.style.display = 'hidden';

}

}

}

}

KMI.BasicInformation?.CheckControlInfluences? = function(ClassArray?, that){

var isInfluenced = false; KMI.common.Info('Method: KMI.BasicInformation?.CheckControlInfluences?'); try {

for(n = 0; n < ClassArray?.length; n++){

var OtherCBControl = byId(ClassArray?[n]); KMI.common.Info(OtherCBControl.id); if(OtherCBControl.checked && OtherCBControl.id != that.id){

return true;

}

} return false;

} catch(exc) {

KMI.common.Info(exc.message);

}

}

Using this, each of the elements that are hide/shown from the selection of a checkbox have the id of the checkbox in their class name. This only handles one dimensional form structure though and has no way of handling extra logic.

I will check into the IRC regularly if you want to pick my hed, I am on the list too :) I would like to provide input if possible as I have put a lot of thought into the ins and outs of this :)

Cheers

w.

Change History (12)

comment:1 Changed 13 years ago by Dustin Machi

Milestone: 0.3release0.4

comment:2 Changed 13 years ago by dylan

Owner: changed from Dylan to dylan

comment:3 Changed 13 years ago by dylan

Status: newassigned

comment:4 Changed 13 years ago by dylan

Milestone: 0.40.5

comment:5 Changed 12 years ago by tk

Sounds like a good idea... any updates on this? (I'm guessing the reporter has long since forgotten this ticket as well...)

-Karl

comment:6 Changed 12 years ago by dylan

Component: GeneralDojox
Milestone: 0.91.0

pushing out as no one has had time to work on this.

comment:7 Changed 12 years ago by Adam Peller

Milestone: 1.02.0

Should we keep this open?

comment:8 Changed 11 years ago by alex

Milestone: 2.01.3

Milestone 2.0 deleted

comment:9 Changed 11 years ago by dylan

Description: modified (diff)
Owner: changed from dylan to nathan
Status: assignednew

Nathan, is there anything in here that is worth adding to your work on forms?

comment:10 Changed 11 years ago by nathan

I think that this functionality might be covered by dojox.form.DropDownStack? or dojox.form.RadioStack?.

comment:11 Changed 11 years ago by Nathan Toone

Owner: changed from nathan to Nathan Toone

comment:12 Changed 11 years ago by Nathan Toone

Resolution: wontfix
Status: newclosed

I'm going to close this - as it's an old bug, without much interest. Also, the dojox.form widgets I mentioned above perform this same sort of functionality (toggling parts of a form on and of, based on a dropdown/radio button)

Note: See TracTickets for help on using tickets.