• 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
Re: Referencing Boolean/WOConditional Values
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Referencing Boolean/WOConditional Values


  • Subject: Re: Referencing Boolean/WOConditional Values
  • From: Robert Walker <email@hidden>
  • Date: Fri, 3 Dec 2004 20:20:52 -0500

Jeremy,

Why use WOConditionals for this in the first place? Use something like the following:

// Instance variables
protected String username;
protected String password;
protected String errorMessage;

// Action method for login form
public WOComponent loginAction() {
// Clear any messages from the previous request-response loop
errorMessage = null;

if (username == null && password == null) {
errorMessage = "Both username and password are required!";
} else if (username == null) {
errorMessage = "Username is required!";
} else if (password == null) {
errorMessage = "Password is required!";
}

// Validate the login here

// Return null to refresh the page
return null;
}

Then simply bind errorMessage to a WOString.

On Dec 3, 2004, at 11:39 AM, Jeremy Matthews wrote:

Ok, I'm having a little logic trouble here. If I have two independent WOConditionals, and I want a third that is dependent upon their results, what is the most efficient way to construct it? I can think of a few (not-so-great) ways, but I'd like to get opinions.

Let's say I have a login screen, with "username" and "password". There are Strings in another location wrapped by WOConditionals. If the ID fails, it sends one message. Should the password fail, there is a second. And should both fail, there is a third.

The logic for the conditionals (supplied earlier):

public
boolean passwordLoginErrorFlag()
{
if ((password == null) || (password.length() == 0)) {
return true;
} else {
return false;
}
}

// the logic for the usernameLoginErrorFlag is the same for this example



Now I can simply copy the logic from the if statements under each woconditional, but surely there is a way to reference them...

Suggestions?

Thanks,
Jeremy



_______________________________________________
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
--
Robert Walker
www.robertwalker1.com

"There are 10 kinds of people in the world. Those who think binary and those who don't."
 _______________________________________________
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

References: 
 >Referencing Boolean/WOConditional Values (From: Jeremy Matthews <email@hidden>)

  • Prev by Date: Re: Development mode URL format question
  • Next by Date: eoModeler quits immediately
  • Previous by thread: Referencing Boolean/WOConditional Values
  • Next by thread: cookie-based sessions with mod_rewrite
  • Index(es):
    • Date
    • Thread