Thanks Samuel.  I see that now.

Have others experienced a problem where a form is submitted and then during 
takeValuesFtomTequest a condition that was false when the page was rendered 
becomes true all of a sudden causing some input elements (textfields, pop-up 
list, etc.) to participate in takeValuesFromRequest even though those elements 
were not on the page when the form was submitted? This causes those elements to 
be set to null.   I've ran into such bugs in the past many times.

I have been able to prevent that from happening by using the following code: 


public class MPVWOConditional extends ERXWOConditional {

   protected boolean conditionValue = false;

   public MPVWOConditional(String name, NSDictionary dict, WOElement element) {
      super(name, dict, element);
   }

   @Override
   public void appendToResponse(WOResponse woresponse, WOContext wocontext) {
      // Cache the condition every time the page is being rendered
      conditionValue = 
_condition.booleanValueInComponent(wocontext.component());
      super.appendToResponse(woresponse, wocontext);
   }

   /**
    * Returns the value for the condition binding cached during 
appendToResponse.
    * This makes the takeValuesFromRequest consistent with the appendToResponse
    * preceding it by making sure that input elements that were not present on
    * the page at the time the form was submitted do not participate in
    * takeValuesFromRequest inadvertently.
    */
    @Override
    protected boolean conditionInComponent(WOComponent wocomponent) {
       return conditionValue;
    }
}




> On Mar 14, 2017, at 9:39 AM, Samuel Pelletier <sam...@samkar.com> wrote:
> 
> Hi,
> 
> If you use inline bindings with ONGL, the class WOHelperFunctionTagRegistry 
> registers classes mapped to tag 
> 
>               WOHelperFunctionTagRegistry.registerTagShortcut("ERXElse", 
> "else");
>               
> WOHelperFunctionTagRegistry.registerTagShortcut("ERXWOConditional", "if");
>               
> WOHelperFunctionTagRegistry.registerTagShortcut("ERXWOConditional", 
> "conditional");
> 
> Samuel
> 
> 
>> Le 13 mars 2017 à 19:46, Ricardo Parada <rpar...@mac.com 
>> <mailto:rpar...@mac.com>> a écrit :
>> 
>> Hi all,
>> 
>> Does anybody know where does ERXWOConditional install to replace 
>> WOConditional?
>> 
>> I created an MPVWOConditional which extends ERXWOConditional and fixes a bug 
>> and want to install it as the one to use for WOConditional. 
>> 
>> I checked in ERXPatches but it does not seem to be getting installed there.  
>> Does anybody know?
>> 
>> Thanks
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com 
>> <mailto:Webobjects-dev@lists.apple.com>)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com 
>> <https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com>
>> 
>> This email sent to sam...@samkar.com <mailto:sam...@samkar.com>
 _______________________________________________
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

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

Reply via email to