Re: Catching Matching Values in User TextField against EO
Re: Catching Matching Values in User TextField against EO
- Subject: Re: Catching Matching Values in User TextField against EO
- From: "Jonathan Fleming" <email@hidden>
- Date: Wed, 23 Apr 2003 15:49:24 +0100
From: Igor Crivellari <email@hidden>
To: "Jonathan Fleming" <email@hidden>
CC: email@hidden
Subject: Re: Catching Matching Values in User TextField against EO
Date: Wed, 23 Apr 2003 15:15:57 +0200
Hi,
I'm not sure what exactly you want do, ...., but if aListOf_ImagePositions
is dynamic, you can create it in your DB and make a relation ship with
tbClientData.
The list is static and what I am trying to do is determine whether a
imagePosition value is being used in the database for that user
After that, (there are many ways to do that), you can use
WOExtentions.WOToOneRelationship component choosing uiStyle "popup". It
will manage your toOne relationship.
I recreated a similar component that take in consideration Nested Editing
Context and Faults and work very well.
any examples?
Igor Crivellari
At 13.39 23/04/2003 +0100, you wrote:
G'day Developers,
Hope you're all well and chirpy today.
Right, small problem solve for the fit...
I have a PopUpButton that simply lists numbers 01 - 50 set like this:
PopUpButton_imagePosition: WOPopUpButton {
list = aListOf_ImagePositions;
selection = tbClientData.imagePosition;
name = "imagePositions";
noSelectionString = "";
}
where tbClientData is my business logic EOCustomObject, however, I want to
be able to run a bit of code that will stop the user setting the EO with a
value that is already taken. For example if images ONE, TWO and THREE have
been given the positions 01, 02 and 03 repectivley then I want to stop the
user from setting his fourth image (FOUR) to 02 or any of the already
used-up position numbers.
Can someone help me out with what code I am supposed to use? In the
meantime I have been trying to use the code below but I can not figure out
how to get it to work properly (the bit of code we are concerned with
starts at // CHECK THAT THE IMAGE POSITION ISN'T ALREADY TAKEN (I sent the
full method so you can see what I am trying to do):
// ImagePosition = required
public String validateImagePosition(String newImagePosition)
throws NSValidation.ValidationException {
if (newImagePosition == null || newImagePosition.equals("")) {
throw new NSValidation.ValidationException("You must set
the image position Eg. the order in which it will list. \"01 - first\",
\"02 - second\", \"03 - third\", \"04 - fourth\" etc.");
}
// CHECK THAT THE IMAGE POSITION ISN'T ALREADY TAKEN
EOEditingContext editingContext = new EOEditingContext();
//editingContext.setSharedEditingContext(null);
NSArray results =
EOUtilities.rawRowsMatchingKeyAndValue(editingContext, "TbClientData",
"imagePosition", imagePosition());
if (results.count() > 0) {
newImagePosition.equals("reset");
if (newImagePosition.equals("reset")) {
throw new NSValidation.ValidationException("The
position you set for this image: " + imagePosition() + " is already taken.
Please choose another");
}
}
return newImagePosition;
}
If there is an easier or better way than the route I am trying to take, I
welcome your suggestions.
Kind regards
Jonathan F :^)
_________________________________________________________________
Use MSN Messenger to send music and pics to your friends
http://www.msn.co.uk/messenger
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_________________________________________________________________
Express yourself with cool emoticons http://www.msn.co.uk/messenger
_______________________________________________
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.