You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Borja Martín <bo...@dagi3d.net> on 2005/04/06 19:15:23 UTC

problem with hidden fields and f:params int the same form

hi,
I would like to know if this behaviour is a bug or not.

suppose I have this form(I have simplified it so its easier to understand):

<h:form>
  
    <f:subview id="edit" rendered="#{cover.isItemSaved}">
         <h:commandLink action="#{cover.editNews}">
            <h:outputText value="edit" />
                <f:param name="section" value="#{sections.path}" />
        </h:commandLink>
    </f:subview>
   
    <h:inputText value="#{cover.item.title}" required="true" size="50" />
   
    <h:inputHidden id="section" value="#{sections.path}" />

    <h:commandButton action="#{cover.save}" value="save" />
</h:form>

as you see, there is a hidden field called 'section' and a parameter for 
the commandlink called 'section' too.
the problem is that as longer as both have the same name, the hidden 
field will not be sent to the form, but when I change the name, I can 
retrieve its value with no problem. so, why is the parameter name 
affecting the whole form?
It seems that the commandlink is called when the form is submitted. does 
this behaviour correspond to the jsf specifications?

thanks in advance


Re: problem with hidden fields and f:params int the same form

Posted by Borja Martín <bo...@dagi3d.net>.
then the problem possibly resides on the way I'm retrieving the param 
values, as first I'll look for a param called 'section' and then for a 
one whose name ends with ':section'
the thing is that I didnt know the fparam would also be sent

thanks for the explanation

Heath Borders wrote:
> The f:param name for commandLinks is rendered as a URL parameter.  Thus, 
> the name you supply is not modified to contain parent NamingContainer 
> names (should it?).  However, your hidden input shouldn't be affected 
> because its clientId should be something like '_1:section', and not 
> 'section'.
> 
> On Apr 6, 2005 12:15 PM, *Borja Martín* <borjam@dagi3d.net 
> <ma...@dagi3d.net>> wrote:
> 
>     hi,
>     I would like to know if this behaviour is a bug or not.
> 
>     suppose I have this form(I have simplified it so its easier to
>     understand):
> 
>     <h:form>
> 
>        <f:subview id="edit" rendered="#{cover.isItemSaved}">
>             <h:commandLink action="#{cover.editNews}">
>                <h:outputText value="edit" />
>                    <f:param name="section" value="#{sections.path}" />
>            </h:commandLink>
>        </f:subview>
> 
>        <h:inputText value="#{cover.item.title}" required="true" size="50" />
> 
>        <h:inputHidden id="section" value="#{sections.path}" />
> 
>        <h:commandButton action="#{cover.save}" value="save" />
>     </h:form>
> 
>     as you see, there is a hidden field called 'section' and a parameter for
>     the commandlink called 'section' too.
>     the problem is that as longer as both have the same name, the hidden
>     field will not be sent to the form, but when I change the name, I can
>     retrieve its value with no problem. so, why is the parameter name
>     affecting the whole form?
>     It seems that the commandlink is called when the form is submitted. does
>     this behaviour correspond to the jsf specifications?
> 
>     thanks in advance
> 
> 
> 
> 
> -- 
> -Heath Borders-Wing
> hborders@mail.win.org <ma...@mail.win.org>


Re: problem with hidden fields and f:params int the same form

Posted by Heath Borders <he...@gmail.com>.
The f:param name for commandLinks is rendered as a URL parameter. Thus, the 
name you supply is not modified to contain parent NamingContainer names 
(should it?). However, your hidden input shouldn't be affected because its 
clientId should be something like '_1:section', and not 'section'.

On Apr 6, 2005 12:15 PM, Borja Martín <bo...@dagi3d.net> wrote: 
> 
> hi,
> I would like to know if this behaviour is a bug or not.
> 
> suppose I have this form(I have simplified it so its easier to 
> understand):
> 
> <h:form>
> 
> <f:subview id="edit" rendered="#{cover.isItemSaved}">
> <h:commandLink action="#{cover.editNews}">
> <h:outputText value="edit" />
> <f:param name="section" value="#{sections.path}" />
> </h:commandLink>
> </f:subview>
> 
> <h:inputText value="#{cover.item.title}" required="true" size="50" />
> 
> <h:inputHidden id="section" value="#{sections.path}" />
> 
> <h:commandButton action="#{cover.save}" value="save" />
> </h:form>
> 
> as you see, there is a hidden field called 'section' and a parameter for
> the commandlink called 'section' too.
> the problem is that as longer as both have the same name, the hidden
> field will not be sent to the form, but when I change the name, I can
> retrieve its value with no problem. so, why is the parameter name
> affecting the whole form?
> It seems that the commandlink is called when the form is submitted. does
> this behaviour correspond to the jsf specifications?
> 
> thanks in advance
> 
> 


-- 
-Heath Borders-Wing
hborders@mail.win.org