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

Re: [SOLVED] Calling action passed via biding in subcomponent.


  • Subject: Re: [SOLVED] Calling action passed via biding in subcomponent.
  • From: Johnny Miller <email@hidden>
  • Date: Sun, 04 Nov 2012 11:29:00 -1000

Cool!  One more thing you might want to try is to have your component subclass ERXDynamicElement.  That will make it more memory efficient.

Johnny Miller
Kahalawai Media Co.

On Nov 4, 2012, at 9:51 AM, Miguel Torres <email@hidden> wrote:

Hi Johnny,

I reviewed the code of ERXLinkButton5 and found what I guess the code to do what Chuck suggested.

This is the code that did the trick:


public WOActionResults invokeAction(WORequest request, WOContext context) {
    WOActionResults anActionResult = null;
if(context.wasFormSubmitted()) {
if(context.isMultipleSubmitForm()) {
if(request.formValueForKey(context.elementID()) != null) {
context.setActionInvoked(true);
anActionResult = (WOActionResults)valueForBinding("action");
}
} else {
context.setActionInvoked(true);
anActionResult = (WOActionResults)valueForBinding("action");
}
}
return anActionResult;
    }

Thanks.



 

On 03/11/2012, at 16:38, Johnny Miller <email@hidden> wrote:

Hi Miguel,

I believe what you are looking for is ERXLinkButton5 in er.extensions.components

Best,

Johnny

On Nov 2, 2012, at 12:02 PM, Miguel Torres <email@hidden> wrote:

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: 
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: 
 >Calling action passed via biding in subcomponent. (From: Miguel Torres <email@hidden>)
 >Re: Calling action passed via biding in subcomponent. (From: Johnny Miller <email@hidden>)
 >Re: [SOLVED] Calling action passed via biding in subcomponent. (From: Miguel Torres <email@hidden>)

  • Prev by Date: Re: [SOLVED] Calling action passed via biding in subcomponent.
  • Next by Date: JavaMelody + WebObjects
  • Previous by thread: Re: [SOLVED] Calling action passed via biding in subcomponent.
  • Next by thread: Instances limit per host?
  • Index(es):
    • Date
    • Thread