• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Disabled field set to null by EO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Disabled field set to null by EO


  • Subject: Disabled field set to null by EO
  • From: Drew Thoeni <email@hidden>
  • Date: Sun, 2 Jul 2006 16:36:00 -0400

I have a field that I am setting to disabled using the below logic.


/** Disables the official entry text field if viewer is not "assigned to" employee 
    to prevent changes to the official entry by others than the owner
*/
    protected boolean isOfficialEntryDisabled() {
if ( session.employeeLoggedIn == reportEntryItem.employeeassignedto() ) {
    return false;
}
return true;
    }

Other elements of this object can be updated at will and the system performs as expected. However, if an admin (who is allowed to change the employeeassignedto relationship) changes the employee this record is assigned to, the system assumes the field is null.

Restated, it appears that when the field is disabled, and the record is changed so the current logged-in employee becomes the owner, EO believes the field is null (checked the SQL logs to determine this). Oddly, this behavior does not occur when changing any other field, or even changing the owner to an employee other than the one logged in.

Some more relevant code:

FROM COMPONENT EntryEditPage
/** Saves changes to this segment ReportEntry and returns user to EntryListPage page. */
    protected EntryListPage saveEntry() {
  reportEntryItem.setLastUpdateTime( new NSTimestamp() );  // sets last update time to current time
  reportEntryItem.setEmployeelastupdated( session.employeeLoggedIn );  // sets last update by to person logged in
  reportEntryItem.setWordCount( reportEntryItem.numberOfWords( reportEntryItem.reportEntry() ) );  // sets wordCount for this entry.
  ec.saveChanges();
   EntryListPage nextPage = (EntryListPage)pageWithName("EntryListPage");
   return nextPage;
    }

FROM CLASS ReportEntry
/** Counts the number of words in a given lenght of text.
    If the incoming text is null, word count is returned as zero.
*/
    public int numberOfWords( String aLengthOfText ) {
if ( null == aLengthOfText ) {
    return 0;
}
StringTokenizer st = new StringTokenizer( aLengthOfText, " " );
return st.countTokens();
    }

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: EOF Inheritance, Relationships between super class and subclass
  • Next by Date: Re: EOF Inheritance, Relationships between super class and subclass
  • Previous by thread: Re: EOF Inheritance, Relationships between super class and subclass
  • Next by thread: Wonder Apache 2 Adaptor Help
  • Index(es):
    • Date
    • Thread