You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "LOCHART,DOUGLAS E" <do...@cablespeed.com> on 2005/03/21 18:23:17 UTC

Help with contrib:Choose in a Form

Greetings all and thanks in advance.

I have page that represents a Question.  That page will 
have either one of two forms displayed, an Options form if 
the user is expected to answer the question or a Rule 
Notification form if a rule fired from a previous question 
submission.

The Rule form contains the following a contrib:Choose 
block that renders the appropriate submit button 
combination depending on the rule type.  In a nutshell 
there could be a Yes button or a Yes and No button.

Everything works fine except when I do a "Back" action to 
get back to the page with the Rule form.  WHen its 
resubmitted I get a stale link thing happening.  I was 
getting null pointers in the ognl but its the same 
symptoms.

I avoided stale links with the options form by using the 
ListEdit.  I tried to replace the contrib:Choose with the 
formConditional but I could not find any example of how to 
use it anywhere and when I tried it I still had the same 
issues.

Can anyone please she some light on what I can do.  I HAVE 
to avoid a stale link so that I can put the user back on 
the question they are supposed to be answering.  I have it 
working very well for the regular case of questions when 
they use the back button but this conditional submit form 
has me pulling my hair out.

Here is a snippet of the conditional form section:

<span jwcid="@contrib:Choose">
   <span jwcid="@contrib:When" condition='ognl:rule != 
null && "STOP_OK".equalsIgnoreCase(rule.ruleType)'>
     <tr>
       <td class="input-button">
         <input type="submit" jwcid="@Submit"
	listener="ognl:listeners.ruleAcknowledged"
	parameters="Ok" value="Ok"/>
       </td>
     </tr>
   </span>

   <span jwcid="@contrib:When" condition='ognl:rule != 
null && "STOP_ERROR".equalsIgnoreCase(rule.ruleType)'>
     <tr>
       <td class="input-button">
         <input type="submit" jwcid="@Submit"
	listener="ognl:listeners.ruleAcknowledged"
	selected="ognl:ruleResponse" tag="Ok" value="Ok"/>
       </td>
     </tr>
   </span>

   <span jwcid="@contrib:Otherwise">
     <tr>
       <td class="input-button">
         <input type="submit" jwcid="@Submit"
	listener="ognl:listeners.ruleAcknowledged"
	parameters="Unknown Rule" value="Unknown Rule"/>
       </td>
     </tr>
   </span>
</span>


Thanks

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Help with contrib:Choose in a Form

Posted by Kent Tong <ke...@cpttm.org.mo>.
LOCHART,DOUGLAS E <douglochart <at> cablespeed.com> writes:

> I have page that represents a Question.  That page will 
> have either one of two forms displayed, an Options form if 
> the user is expected to answer the question or a Rule 
> Notification form if a rule fired from a previous question 
> submission.

You should have something like:

<span jwcid="@Conditional" condition="ognl:displayOptions">
  <form jwcid="optionsForm@Form">...</form>
</span>
<span jwcid="@Conditional" condition="ognl:!displayOptions">
  <form jwcid="ruleForm@Form">
    <span jwcid="@contrib:FormConditional" 
          condition='ognl:rule != null 
                    && "STOP_OK".equalsIgnoreCase(rule.ruleType)'>
       ...
    </span>
    <span jwcid="@contrib:FormConditional" 
          condition='ognl:rule != null 
                    && "STOP_ERROR".equalsIgnoreCase(rule.ruleType)'>
       ...
    </span>
    <span jwcid="@contrib:FormConditional" 
          condition='ognl:rule == null 
                    || !"STOP_OK".equalsIgnoreCase(rule.ruleType) 
                    && !"STOP_ERROR".equalsIgnoreCase(rule.ruleType)'>
       ...
    </span>
  </form>
</span>

If that doesn't work, show us the exact error message.



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org