Problems trying to build an "Edit Relationship" page
Problems trying to build an "Edit Relationship" page
- Subject: Problems trying to build an "Edit Relationship" page
- From: Steve Sharman <email@hidden>
- Date: Tue, 4 May 2004 00:46:10 +0100
Dear all,
Apologies in advance for a longish post....
I'm currently trying to build a new page for my application which will
allow a user to see and edit "Organisation Types" for a given
organisation - from a business perspective, any organisation may have
zero or more organisation types. I've successfully modelled this in
EOModeler, I have the following relationship in place:
Organisation <-->> OrgClassification
What I am trying to put together is a page that will have a listing of
the current values at the top of the page. Each line will have two
WOActiveImages next to it - one for "Edit" and one for "Delete". There
will also be a button at the bottom for "New" and one for "Save". The
idea that I have is that when "Edit" is clicked, the page will reload,
and show a small set of text fields under the main listing table, which
will be populated with the values of the row corresponding to the
clicked "Edit" image. Clicking on "New" will show the same entry
fields, but unpopulated apart from one field (start date) which will be
populated with the current date.
What I've done so far is to set up a table with an appropriate
WORepetition and WOStrings to display the current data. This works
fine. I've also set up an integer which is the "state" variable to
control the screen display - the idea being that if the state is
"List", nothing will be displayed below the list table; if the state is
"Edit" then the text entry fields as above will be displayed
pre-populated, and if the state is "New" then the text entry fields as
above will be displayed with only the start date prepopulated.
I've set up a WOConditional which wraps the data entry fields - the
table will only be displayed if the current state is "New" or "Edit" as
above. I've bound action methods to the Edit button in the WORepetition
and the New button - initially all these methods would do was to change
the value of the state variable, and return null to reload the page.
This worked fine.
Now what I am trying is the "add new relationship object" piece of
work. I've put in a new variable to hold the new or changed values,
with:
public OrgClassification theNewOrEditedClassItem;
The attributes of "theNewOrEditedClasssItem" are bound to the
WOTextFields for data entry.
and the action that is called when the "New" button is called is as
follows:
public WOComponent newOrgClassAction()
{
OrgClassification theNewOrEditedClassItem = new OrgClassification();
session().defaultEditingContext().insertObject(theNewOrEditedClassItem);
theNewOrEditedClassItem.setStartDate(new NSTimestamp());
_workState = NEW;
return null;
}
I can see that part of the method is working fine - the part that sets
the _workState variable, because when the page reloads, the text fields
to edit the values are displayed below the list table. However, the
text field bound to startDate is not populated, and I would expect it
to be populated with the current date (I've set the date formatter
appropriately for the text field). Once I'd got this piece working, I
was going on to actually set the relationship and save the values....
I'm sure I'm doing something obviously wrong, but I don't know what it
is....! Can anyone give me some pointers as to what I'm doing
incorrectly that I need to change?
Best regards and thanks in advance for any help,
-- Steve
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.