Declan Shanaghy wrote:
> The reason I rely on isSet is because this form can be used for adding a new
> job or editing an existing one.
> In the case of adding a new job I expect isSet to return false so I can pre
> populate a default value

See the defaultValue and emptyValue attributes in the intake.xml file.

> What it all comes down to is that this method of pre populating the html
> form for 
> editing data doesn't work 100% the way I need it, but what im really
> wondering is
> What is the "usual" pattern that other people use for "edit" forms.

I usually do like the following in the screen class:

    Group someGroup = intake.get(groupName, key, false);
    if (someGroup == null)
    {
        MyRecord myRecord;
        someGroup = intake.get(groupName, key, true);

        if (newRecord)
        {
            myRecord = new MyRecord();
        }
        else
        {
            myRecord = getMyRecordFromSomewhere(idRecord);
        }

        someGroup.getProperties(myRecord);
    }


and like the following in the action:

    Group someGroup = intake.get(groupName, key, false);
    if (someGroup != null && someGroup.isAllValid())
    {
        MyRecord myRecord;

        if (newRecord)
        {
            myRecord = new MyRecord();
        }
        else
        {
            myRecord = getMyRecordFromSomewhere(idRecord);
        }

        someGroup.setProperties(myRecord);
        myRecord.save();
    }


Bye, Thomas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to