You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Gary Jackson <ba...@umiacs.umd.edu> on 2007/07/28 04:00:28 UTC

subForm semantics

As I understand it, subForm works like this:

<s:subForm id="inner">
	<h:inputText value="inner"/>
	<t:commandButton value="Submit Inner"/>
</s:subForm>

<h:inputText value="outer"/>
<t:commandButton value="Submit Outer"/>

When the "Submit Inner" button is pressed, everything is validated.

When the "Submit Outer" button is pressed, everything except those 
components inside the "inner" subForm are validated.

Assuming this is true, how do I get the inverse behavior?  That is, I 
want things inside the subForm to be validated when the "Submit Inner" 
button is pressed, but nothing else?

-- 
Gary

Re: subForm semantics

Posted by Gary Jackson <ba...@umiacs.umd.edu>.
Andrew Robinson wrote:
> Sub forms have to be nested. They only exclude data from other
> subForms, not from the form.

Thanks!  It all makes sense now.

-- 
Gary

Re: subForm semantics

Posted by Andrew Robinson <an...@gmail.com>.
Sub forms have to be nested. They only exclude data from other
subForms, not from the form.

<h:form>
1
<s:subForm id="a">
2
  <s:subForm id="b">3</s:subForm>
  <s:subForm id="c">4</s:subForm>
</s:subForm>
</h:form>

1: always submitted
2: submitted if "a" is specified
3: submitted if "b" is specified
4: submitted if "c" is specified

I've only used it a little bit, but I think that is how it works.

On 7/27/07, Gary Jackson <ba...@umiacs.umd.edu> wrote:
>
> Now I'm really confused.  I've tried using subForm two different ways:
> with the subForm scope limiting validation to the contents when inner
> actions occur and subForm scope excluding validation caused by outside
> actions.  Either way, subForm is doing nothing for me.
>
> My current kit is the same from this file, plus the other various things
> that I need for my webapp:
>
> http://people.apache.org/~werpu/tomahawk-sandbox-examples.war
>
> Here is the relevant clause from my web.xml where I configure my taglib
> files:
>
>      <context-param>
>          <description>Tag libraries for facelets</description>
>          <param-name>facelets.LIBRARIES</param-name>
>          <param-value>
>
> /WEB-INF/tomahawk.taglib.xml;/WEB-INF/sandbox.taglib.xml;/WEB-INF/facelets/tags/glcf.taglib.xml
>          </param-value>
>      </context-param>
>
> Here are the entire contents of my sandbox.taglib.xml file:
>
> <?xml version="1.0"?>
> <!DOCTYPE facelet-taglib PUBLIC
>    "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
>    "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
>
> <facelet-taglib>
>      <namespace>http://myfaces.apache.org/sandbox</namespace>
>      <tag>
>          <tag-name>subForm</tag-name>
>          <component>
>              <component-type>org.apache.myfaces.SubForm</component-type>
>              <renderer-type>org.apache.myfaces.SubForm</renderer-type>
>          </component>
>      </tag>
> </facelet-taglib>
>
> If it's relevant, the place where I am using <s:subForm> is inside of a
> JSF core <f:subview> element.
>
> Gary Jackson wrote:
> >
> > As I understand it, subForm works like this:
> >
> > <s:subForm id="inner">
> >     <h:inputText value="inner"/>
> >     <t:commandButton value="Submit Inner"/>
> > </s:subForm>
> >
> > <h:inputText value="outer"/>
> > <t:commandButton value="Submit Outer"/>
> >
> > When the "Submit Inner" button is pressed, everything is validated.
> >
> > When the "Submit Outer" button is pressed, everything except those
> > components inside the "inner" subForm are validated.
> >
> > Assuming this is true, how do I get the inverse behavior?  That is, I
> > want things inside the subForm to be validated when the "Submit Inner"
> > button is pressed, but nothing else?
> >
>
> --
> Gary
>

Re: subForm semantics

Posted by Gary Jackson <ba...@umiacs.umd.edu>.
Now I'm really confused.  I've tried using subForm two different ways: 
with the subForm scope limiting validation to the contents when inner 
actions occur and subForm scope excluding validation caused by outside 
actions.  Either way, subForm is doing nothing for me.

My current kit is the same from this file, plus the other various things 
that I need for my webapp:

http://people.apache.org/~werpu/tomahawk-sandbox-examples.war

Here is the relevant clause from my web.xml where I configure my taglib 
files:

     <context-param>
         <description>Tag libraries for facelets</description>
         <param-name>facelets.LIBRARIES</param-name>
         <param-value>
 
/WEB-INF/tomahawk.taglib.xml;/WEB-INF/sandbox.taglib.xml;/WEB-INF/facelets/tags/glcf.taglib.xml
         </param-value>
     </context-param>

Here are the entire contents of my sandbox.taglib.xml file:

<?xml version="1.0"?>
<!DOCTYPE facelet-taglib PUBLIC
   "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
   "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">

<facelet-taglib>
     <namespace>http://myfaces.apache.org/sandbox</namespace>
     <tag>
         <tag-name>subForm</tag-name>
         <component>
             <component-type>org.apache.myfaces.SubForm</component-type>
             <renderer-type>org.apache.myfaces.SubForm</renderer-type>
         </component>
     </tag>
</facelet-taglib>

If it's relevant, the place where I am using <s:subForm> is inside of a 
JSF core <f:subview> element.

Gary Jackson wrote:
> 
> As I understand it, subForm works like this:
> 
> <s:subForm id="inner">
>     <h:inputText value="inner"/>
>     <t:commandButton value="Submit Inner"/>
> </s:subForm>
> 
> <h:inputText value="outer"/>
> <t:commandButton value="Submit Outer"/>
> 
> When the "Submit Inner" button is pressed, everything is validated.
> 
> When the "Submit Outer" button is pressed, everything except those 
> components inside the "inner" subForm are validated.
> 
> Assuming this is true, how do I get the inverse behavior?  That is, I 
> want things inside the subForm to be validated when the "Submit Inner" 
> button is pressed, but nothing else?
> 

-- 
Gary