control input - if blank not acceptable
control input - if blank not acceptable
- Subject: control input - if blank not acceptable
- From: Wes James <email@hidden>
- Date: Wed, 11 Aug 2004 13:52:36 -0600
In working with a project the main.wo has an add user link, this then
calls a userEntry.wo where the information is entered. There is a
submit button here which then brings the user back to the main.wo with
the input information. What If I want to require that data exist in
the input fields before it is returned to the main.wo. In other words
if the fields are blank, the new object should not be created in the
nsarray in the main.wo, but should indicate a message or something
saying that blank fields are not allowed. Right now, once the submit
is hit, it goes back to the main.wo arena and I can't seem to see how
to check the userEntry fields at this point since it is now back in
the main.wo arena and not in the userEntry arena (userEntry.wo). A
user object is being sent back and forth, but how do talk to it to
check for empty fields?
When the submit button is clicked, I guesss this code runs:
public Main submitChanges() {
Main nextPage = (Main)pageWithName("Main");
System.out.println("Submit button pressed.");
// Initialize your component here.
return nextPage;
}
So I'm taken back to the main page, but I want to stay on the
userEntry page or have some other page show if the user object fields
are empty.
The user object does have this method:
public boolean entryIncomplete() {
boolean entryIncomplete;
if (personName() == null || favoriteFood() == null ||
personName().equals("") || favoriteFood().equals("")) {
System.out.println("The entry is incomplete.");
entryIncomplete = true;
}
else {
System.out.println("The entry is complete.");
entryIncomplete = false;
}
return entryIncomplete;
}
I have tried to us an if statment in the Min submitChanges that
returns the userEntry page, but it says this is a bad type....
Well.... what are some ideas for this?
thanks,
wj
_______________________________________________
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.