wiln / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

AdvancedForm field types #187

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add a DateField to your form
2. Try to reset it value using the resetForm() method
3. It's not resetting

AdvancedForm needs to handle DateField children for snapshot/reset/undo.

in snapshotValues():

if( tmpObj is TextInput || tmpObj is TextArea ) 
    value = tmpObj.text;
if( tmpObj is RadioButton || tmpObj is CheckBox ) 
    value = tmpObj.selected;
if( tmpObj is ComboBox ) 
    value = tmpObj.selectedIndex;
if( tmpObj is NumericStepper ) 
    value = tmpObj.value;
if( tmpObj is DateField ) 
    value = tmpObj.selectedDate;

in resetValues():

if( snapshotModel[ tmpID ] == undefined 
    && ( tmpObj is Container
        || ( !(tmpObj is TextInput)
            && !(tmpObj is RadioButton)
            && !(tmpObj is ComboBox)
            && !(tmpObj is NumericStepper)
            && !(tmpObj is DateField) )
        ) )                     
    continue;
if( snapshotModel[ tmpID ] == undefined )
    throw new Error( "Invalid obj in snapshot: " + tmpID );
var value:Object;
if( tmpObj is TextInput || tmpObj is TextArea ) 
    tmpObj.text = snapshotModel[ tmpID ];
if( tmpObj is RadioButton || tmpObj is CheckBox ) 
    tmpObj.selected = snapshotModel[ tmpID ];
if( tmpObj is ComboBox ) 
    tmpObj.selectedIndex = snapshotModel[ tmpID ];
if( tmpObj is NumericStepper ) 
    tmpObj.value = snapshotModel[ tmpID ];
if( tmpObj is DateField ) 
    tmpObj.selectedDate = snapshotModel[ tmpID ];

Original issue reported on code.google.com by afil...@gmail.com on 20 Jan 2009 at 4:54