• 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
Calling action passed via biding in subcomponent.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling action passed via biding in subcomponent.


  • Subject: Calling action passed via biding in subcomponent.
  • From: Miguel Torres <email@hidden>
  • Date: Fri, 02 Nov 2012 16:02:56 -0600

Hi List,

I am creating a Component to use <button > HTML tag in my apps.

I am implementing Bootstrap in my WO application and I want to create buttons with icons.

I followed the example in the book Practical WebObjects, chapter 6 that creates a Hyperlink Component.

This is my code based on the book's example:

public class BootstrapSubmitButton extends ERXComponent {
    public BootstrapSubmitButton(WOContext context) {
        super(context);
    }

    

    @Override
    public void appendToResponse(WOResponse response, WOContext context) {
    String tabindex = stringValueForBinding("tabindex");
    String cssClass = "btn "+stringValueForBinding("class", "");
    String icon = stringValueForBinding("icon");

    

    response.appendContentString("<button name=\""+context.elementID()+"\"");
    if(tabindex != null){
    response.appendContentString("tabindex=\""+tabindex+"\" ");
    }
    response.appendContentString("class=\""+cssClass+"\"  type=\"submit\">");
    if(icon != null){
    response.appendContentString("<i class=\""+stringValueForBinding("icon")+"\"  > </i>&nbsp;");
    }
    response.appendContentString(stringValueForBinding("value"));
    response.appendContentString("</button>");
    }

    

    @Override
    public boolean synchronizesVariablesWithBindings() {
    return false;
    }

    

    @Override
    public WOActionResults invokeAction(WORequest request, WOContext context) {
    if(context.elementID().startsWith(context.senderID())){ 
    return (WOActionResults)valueForBinding("action");
    }
    return null;
    }
}


I just changed a line: 

     if(context.elementID().startsWith(context.senderID())){ 

The example in the book is coded like this:
     if(context.elementID().equals(context.senderID())){ 

I had to changed it because it was not working, debugging the code I found that the element's ID is never equals to the sender's ID. It sounds logic because they are two different objects.

I think my change is correct.

Am I right and that's an error in the book's example?

Did I misunderstand the concepts in the book and I am doing something dangerous for my application?

Thanks in advance.

Miguel Torres.





 _______________________________________________
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

  • Follow-Ups:
    • Re: Calling action passed via biding in subcomponent.
      • From: Johnny Miller <email@hidden>
    • Re: Calling action passed via biding in subcomponent.
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Wonder release candidate 5.8.1
  • Next by Date: Re: Calling action passed via biding in subcomponent.
  • Previous by thread: Wonder release candidate 5.8.1
  • Next by thread: Re: Calling action passed via biding in subcomponent.
  • Index(es):
    • Date
    • Thread