Re: Passing data to another component

2010-07-31 Thread Jeremy Doseck
Hi Johann,
Thank you for your explanations and example.
I tried to do it with first option.

public String name;

public void setName(String name) {
   this.name = name;
}

I had some struggle with it but finally, I made it!
In fact, I am trying to do contact form with some textfields and popups,
with required fields in it. Then display selected values on the next page
(after clicked on the submit) in some proper table, then send to the mail..

anyway, thanks again.

Jeremy

2010/7/28 Johann Werner j...@oyosys.de

 Hi Jeremy,

 Am 27.07.2010 um 16:55 schrieb Jeremy Doseck:

  Hi, I've been trying to solve problem with passing inserted data to
 another page (component). Can anyone give me simple example how to do it?
  I need to pass written data by the user (WOString) to nextcomp.wo and
 display them there. Trying not to use inline bindings. Here I tried to do
 that:
 
  public String name;
  public Object goToAnotherComponent;  //this is WOSubmitButton action
 binding

 what is this line for? You bind your action to the method below.

 
  public nextcomp goToAnotherComponent() {

 Having class that begin with lowercase letters is ok but you should stick
 to the usual java naming scheme. Your code will be better to read especially
 if your code base grows.

  nextcomp nextPage = (nextcomp)pageWithName(nextcomp);
  nextPage.setSelectedPopup(selectedNumber);
  nextPage.setName(name);
  return nextPage;
 
  I think I need to put some code in nextcomp.wo component to display set
 Value but have no idea how..

 You have two choices here:

 1. put into your nextcomp class two public ivars that will hold the values
 for selectedNumber and name. Then you can use KVC (Key Value Coding) to set
 those values:

 nextPage.takeValueForKey(selectedNumber, selectedPopup);
 nextPage.takeValueForKey(name, name);

 Look at
 http://developer.apple.com/legacy/mac/library/documentation/InternetWeb/Reference/WO542Reference/com/webobjects/foundation/NSKeyValueCoding.DefaultImplementation.htmlfor
  some more info.

 2. put into your nextcomp class two ivars (not necessary public) and create
 setter methods for both. So for example for name you would have:

 public String name;

 public void setName(String name) {
this.name = name;
 }

 Hope this is helping you.

 jw

 
  Thanks for the answers;
 
  Jeremy



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Passing data to another component

2010-07-27 Thread Jeremy Doseck
Hi, I've been trying to solve problem with passing inserted data to another
page (component). Can anyone give me simple example how to do it?
I need to pass written data by the user (WOString) to nextcomp.wo and
display them there. Trying not to use inline bindings. Here I tried to do
that:

public String name;
public Object goToAnotherComponent;  //this is WOSubmitButton action binding

public nextcomp goToAnotherComponent() {
nextcomp nextPage = (nextcomp)pageWithName(nextcomp);
nextPage.setSelectedPopup(selectedNumber);
nextPage.setName(name);
return nextPage;

I think I need to put some code in nextcomp.wo component to display set
Value but have no idea how..

Thanks for the answers;

Jeremy
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com