Re: WOPopUpButton problem...

David LeBer <[email protected]>
Newsgroups gmane.comp.web.webobjects.newbies
Message-ID <[email protected]>
On Dec 8, 2004, at 1:13 AM, Jade Gazer wrote:

>
> by the way my:
>   userlevel - varchar
>
> and i didnt put any relationship to
> authenticationlevel entity
> But whatever your suggestion is, that would be
> appreciated, any working step or guides would be much
> more appreciated too..
>
> thanks in advance.
>
>
> ===============start of .wod file==============
> Form1: WOForm {
> 	multipleSubmit = true;
> }
>
> Form2: WOForm {
> 	multipleSubmit = true;
> }
>
> Hyperlink3: WOHyperlink {
> 	action = delUser;
> }
>
> Hyperlink4: WOHyperlink {
> 	action = edtUser;
> }
>
> PasswordField1: WOPasswordField {
> 	value = user.usr_pwd;
> }
>
> PopUpButton1: WOPopUpButton {
> 	displayString = authItem.aut_des;
> 	item = authItem;
> 	list = authList;
> 	noSelectionString = " -- ";
> 	selection = userItem.usr_level;
> }

Above you mention userLevel, yet here it is usr_level, are these the 
same?

You say that there is no relationship between UserInfo and AuthLevel 
right?

The way the WOPopup is wired is to try to set assign userItem.usr_level 
to the selected AuthLevel from the authList. If usr_level is a varchar, 
then I don't believe that it is expecting an AuthLevel object.

>
> Repetition1: WORepetition {
> 	item = authItem;
> 	list = authList;
> }
>
> Repetition2: WORepetition {
> 	item = userItem;
> 	list = userList;
> }
>
> String3: WOString {
> 	value = userItem.usr_fname;
> }
>
> String4: WOString {
> 	value = userItem.usr_lname;
> }
>
> SubmitButton2: WOSubmitButton {
> 	action = addUser;
> 	value = "Add";
> }
>
> SubmitButton6: WOSubmitButton {
> 	action = updUser;
> 	value = "Update";
> }
>
> SubmitButton7: WOSubmitButton {
> 	action = revChanges2;
> 	value = "Revert";
> }
>
> SubmitButton8: WOSubmitButton {
> 	action = savChanges2;
> 	value = "Save";
> }
> ===========end of .wod file==============
> --- David LeBer <[email protected]> wrote:
>
>>
>> On Dec 7, 2004, at 10:59 PM, jdgazer wrote:
>>
>>>
>>>
>>> Can someone help me with this, im really stuck
>> with it, i know that
>>> there have been some existing issues with
>> WOPopUpButton, ive tried
>>> working with but havent got it right, hopefully
>> someone could give me
>>> a precise guide on this, here is my schema:
>>>
>>> two tables (reference tables)
>>> - userinformation
>>> ->userid (primary)
>>> ->username
>>> ->userpassword
>>> ->userlevel
>>> - authenticationlevel
>>> ->authid (primary)
>>> ->autdescription (values[admin,supervisor,staff])
>>>
>>> So basically the scenario is that a page used to
>> add users, having
>>> WOPopUpButton displaying user authentication. I
>> had it displayed,
>>> Unfortunately i cant save it. Here some snippet
>> with my code:
>>>
>>
> ----------------------------------------------------------------
>>
>> You can't save it? What can't you save? What
>> happens?
>>
>> Also, what are your bindings for the WOPopupButton?
>> Can we see it's
>> snippet from the .wod?
>>
>>> public class Main extends WOComponent {
>>>
>>> protected AuthLevel auth;
>>> protected AuthLevel authItem;
>>>
>>> protected UserInfo user;
>>> protected UserInfo userItem;
>>>
>>> /** @TypeInfo AuthLevel */
>>> protected NSMutableArray authList;
>>> /** @TypeInfo UserInfo */
>>> protected NSMutableArray userList;
>>>
>>> private EOEditingContext editingContext;
>>> private EOFetchSpecification fetchSpec;
>>>
>>> private EOEditingContext editingContext2;
>>> private EOFetchSpecification fetchSpec2;
>>>
>>> public Main(WOContext context) {
>>> super(context);
>>>
>>> fetchSpec = new EOFetchSpecification
>>> ("userinformation", null, null);
>>> editingContext =
>> session().defaultEditingContext();
>>
>> Why two editing context variables?
>>
>> You are assigning them to the same context.
>> (session().defaultEditingContext())
>>
>> It is usually considered dangerous to assign this to
>> a variable, I
>> usually subclass my components from a common parent
>> that has
>> convenience methods like:
>>
>> public EOEditingContext ec() {
>> 	return session().defaultEditingContext();
>> }
>>
>>> authList = new NSMutableArray
>>>
>>
> (editingContext.objectsWithFetchSpecification(fetchSpec));
>>> auth = new AuthLevel();
>>>
>>> //======
>>>
>>> fetchSpec2 = new EOFetchSpecification
>>> ("authenticationlevel", null, null);
>>> editingContext2 =
>> session().defaultEditingContext();
>>>
>>> userList = new NSMutableArray
>>>
>>
> (editingContext2.objectsWithFetchSpecification(fetchSpec2));
>>> user = new UserInfo();
>>>
>>> }
>>>
>>> public WOComponent addUser()
>>> {
>>> if(!userList.containsObject(user)){
>>> userList.addObject(user);
>>> editingContext2.insertObject(user);
>>> user = new UserInfo();
>>> }
>>> return null;
>>> }
>>>
>>> public WOComponent delUser()
>>> {
>>> userList.removeObject(userItem);
>>> EOEditingContext ec = userItem.editingContext();
>>> ec.deleteObject(userItem);
>>> return null;
>>> }
>>>
>>> public WOComponent edtUser()
>>> {
>>> user = userItem;
>>> return null;
>>> }
>>>
>>> public WOComponent updUser()
>>> {
>>> user = new UserInfo();
>>> return null;
>>> }
>>>
>>> public WOComponent revChanges2()
>>> {
>>> editingContext2.revert();
>>> userList = new NSMutableArray
>>>
>>
> (editingContext2.objectsWithFetchSpecification(fetchSpec2));
>>> return null;
>>> }
>>>
>>> public WOComponent savChanges2()
>>> {
>>> editingContext2.saveChanges();
>>> return null;
>>> }
>>>
>>> }
>>>
>>>
>>>
>>
> ------------------------------------------------------
>>> Any help would be much appreciated, this is the
>> only thing that holds
>>> me from my project completion.
>>>
>>> Thank you
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> ;david
>>
>> --
>> David LeBer
>> Codebase Software Systems
>> site:   http://www.codebase.ca
>> blog: http://david.codebase.ca
>>
>>
>
>> ATTACHMENT part 2 application/pkcs7-signature
> name=smime.p7s
>
>
>
>
> 		
> __________________________________
> Do you Yahoo!?
> Meet the all-new My Yahoo! - Try it today!
> http://my.yahoo.com
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

;david

--
David LeBer
Codebase Software Systems
site:   http://www.codebase.ca
blog: http://david.codebase.ca
smime.p7s (application/pkcs7-signature, 2.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.