You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/01/02 10:33:25 UTC

hidden input not refreshed

Hi guys,


in cdi tcks there is:

<h:form id="ajaxForm">
 <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
id="conversationId" />
 <h:inputText value="#{storm.strength}" id="stormStrength" />
 <h:commandButton action="#{storm.beginConversation}"
  value="Begin conversation" id="beginConversationButton">
  <f:ajax render="@form" />
 </h:commandButton>
 <h:commandButton value="Thunder" id="thunderButton">
  <f:ajax execute="stormStrength" />
  <!-- Rerender the whole form - conversation id is part of form
action attribute -->
  <!-- f:param name="cid"
value="#{javax.enterprise.context.conversation.id}" /-->
 </h:commandButton>
</h:form>

seems when ajax rendering is triggered h:inputHidden is not refresh,
is it expected?


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau

Re: hidden input not refreshed

Posted by Romain Manni-Bucau <rm...@gmail.com>.
issue solved! content type header was misread! sorry for the noise



Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau

2015-01-02 12:54 GMT+01:00 Ludovic Pénet <l....@senat.fr>:

> You can also give your input hidden an id and request its update this way.
> Avoids re-sendind all form...
>
> Best regards,
>
> Le 2 janvier 2015 11:21:10 UTC+01:00, Romain Manni-Bucau <
> rmannibucau@gmail.com> a écrit :
>
>> @this will just refresh the commandButton no? so it is really @form
>> (goal would be to refresh the conversation id).
>>
>> Could it be a difference between MF and Mojarra - it is taken from CDI
>> TCKs so I guess it was passed using mojarra?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2015-01-02 11:16 GMT+01:00 Thomas Andraschko <an...@gmail.com>:
>>
>>>  I see Romain. It should work for the first button...
>>>  You could try to add execute="@this" but it should work without, too.
>>>
>>>  2015-01-02 11:01 GMT+01:00 Mert ÇALIŞKAN
>>> <mc...@gmail.com>:
>>>
>>>  Yes, default value of f:ajax is @none.
>>>>  But also by default the element that triggers the request, which is
>>>>  <h:commandButton> in your case, will get re-rendered (refreshed with your
>>>>  statement).
>>>>  so your inputHidden will not be updated unless specified.
>>>>
>>>>  Cheers,
>>>>
>>>>  M.
>>>>  ————
>>>>  Oracle Java Champion
>>>>  Developer (http://www.t2.com.tr), Lecturer (
>>>>  http://www.cs.hacettepe.edu.tr/kisiler.html), JUG Leader (
>>>>  http://www.ankarajug.org), Author (http://www.amazon.com/author/mert)
>>>>
>>>>
>>>>
>>>>  On Friday 2 January 2015 at 11:51, Thomas Andraschko wrote:
>>>>
>>>>  Hey Romain,
>>>>>
>>>>>  AFAIR the default for the render attribute of f:ajax is @none, so
>>>>>
>>>>  therefore
>>>>
>>>>>  it's expected. You would need to set it to e.g. render="@form"
>>>>>
>>>>>  2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com
>>>>>
>>>>  (mailto:rmannibucau@gmail.com)>:
>>>>
>>>>>
>>>>>  Hi guys,
>>>>>>
>>>>>>
>>>>>>  in cdi tcks there is:
>>>>>>
>>>>>>  <h:form id="ajaxForm">
>>>>>>  <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
>>>>>>  id="conversationId" />
>>>>>>  <h:inputText value="#{storm.strength}" id="stormStrength" />
>>>>>>  <h:commandButton action="#{storm.beginConversation}"
>>>>>>  value="Begin conversation" id="beginConversationButton">
>>>>>>  <f:ajax render="@form" />
>>>>>>  </h:commandButton>
>>>>>>  <h:commandButton value="Thunder" id="thunderButton">
>>>>>>  <f:ajax execute="stormStrength" />
>>>>>>  <!-- Rerender the whole form - conversation id is part of form
>>>>>>  action attribute -->
>>>>>>  <!-- f:param name="cid"
>>>>>>  value="#{javax.enterprise.context.conversation.id}" /-->
>>>>>>  </h:commandButton>
>>>>>>  </h:form>
>>>>>>
>>>>>>  seems when ajax rendering is triggered h:inputHidden is not refresh,
>>>>>>  is it expected?
>>>>>>
>>>>>>
>>>>>>  Romain Manni-Bucau
>>>>>>  @rmannibucau
>>>>>>
>>>>>> http://www.tomitribe.com
>>>>>>  http://rmannibucau.wordpress.com
>>>>>>  https://github.com/rmannibucau
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
> --
> Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.
>
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>

Re: hidden input not refreshed

Posted by Ludovic Pénet <l....@senat.fr>.
You can also give your input hidden an id and request its update this way. Avoids re-sendind all form...

Best regards,

Le 2 janvier 2015 11:21:10 UTC+01:00, Romain Manni-Bucau <rm...@gmail.com> a écrit :
>@this will just refresh the commandButton no? so it is really @form
>(goal would be to refresh the conversation id).
>
>Could it be a difference between MF and Mojarra - it is taken from CDI
>TCKs so I guess it was passed using mojarra?
>
>
>Romain Manni-Bucau
>@rmannibucau
>http://www.tomitribe.com
>http://rmannibucau.wordpress.com
>https://github.com/rmannibucau
>
>
>2015-01-02 11:16 GMT+01:00 Thomas Andraschko
><an...@gmail.com>:
>> I see Romain. It should work for the first button...
>> You could try to add execute="@this" but it should work without, too.
>>
>> 2015-01-02 11:01 GMT+01:00 Mert ÇALIŞKAN <mc...@gmail.com>:
>>
>>> Yes, default value of f:ajax is @none.
>>> But also by default the element that triggers the request, which is
>>> <h:commandButton> in your case, will get re-rendered (refreshed with
>your
>>> statement).
>>> so your inputHidden will not be updated unless specified.
>>>
>>> Cheers,
>>>
>>> M.
>>> ————
>>> Oracle Java Champion
>>> Developer (http://www.t2.com.tr), Lecturer (
>>> http://www.cs.hacettepe.edu.tr/kisiler.html), JUG Leader (
>>> http://www.ankarajug.org), Author
>(http://www.amazon.com/author/mert)
>>>
>>>
>>>
>>> On Friday 2 January 2015 at 11:51, Thomas Andraschko wrote:
>>>
>>> > Hey Romain,
>>> >
>>> > AFAIR the default for the render attribute of f:ajax is @none, so
>>> therefore
>>> > it's expected. You would need to set it to e.g. render="@form"
>>> >
>>> > 2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau
><rmannibucau@gmail.com
>>> (mailto:rmannibucau@gmail.com)>:
>>> >
>>> > > Hi guys,
>>> > >
>>> > >
>>> > > in cdi tcks there is:
>>> > >
>>> > > <h:form id="ajaxForm">
>>> > > <h:inputHidden
>value="#{javax.enterprise.context.conversation.id}"
>>> > > id="conversationId" />
>>> > > <h:inputText value="#{storm.strength}" id="stormStrength" />
>>> > > <h:commandButton action="#{storm.beginConversation}"
>>> > > value="Begin conversation" id="beginConversationButton">
>>> > > <f:ajax render="@form" />
>>> > > </h:commandButton>
>>> > > <h:commandButton value="Thunder" id="thunderButton">
>>> > > <f:ajax execute="stormStrength" />
>>> > > <!-- Rerender the whole form - conversation id is part of form
>>> > > action attribute -->
>>> > > <!-- f:param name="cid"
>>> > > value="#{javax.enterprise.context.conversation.id}" /-->
>>> > > </h:commandButton>
>>> > > </h:form>
>>> > >
>>> > > seems when ajax rendering is triggered h:inputHidden is not
>refresh,
>>> > > is it expected?
>>> > >
>>> > >
>>> > > Romain Manni-Bucau
>>> > > @rmannibucau
>>> > > http://www.tomitribe.com
>>> > > http://rmannibucau.wordpress.com
>>> > > https://github.com/rmannibucau
>>> > >
>>> >
>>> >
>>> >
>>>
>>>
>>>

-- 
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

Re: hidden input not refreshed

Posted by Romain Manni-Bucau <rm...@gmail.com>.
@this will just refresh the commandButton no? so it is really @form
(goal would be to refresh the conversation id).

Could it be a difference between MF and Mojarra - it is taken from CDI
TCKs so I guess it was passed using mojarra?


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2015-01-02 11:16 GMT+01:00 Thomas Andraschko <an...@gmail.com>:
> I see Romain. It should work for the first button...
> You could try to add execute="@this" but it should work without, too.
>
> 2015-01-02 11:01 GMT+01:00 Mert ÇALIŞKAN <mc...@gmail.com>:
>
>> Yes, default value of f:ajax is @none.
>> But also by default the element that triggers the request, which is
>> <h:commandButton> in your case, will get re-rendered (refreshed with your
>> statement).
>> so your inputHidden will not be updated unless specified.
>>
>> Cheers,
>>
>> M.
>> ————
>> Oracle Java Champion
>> Developer (http://www.t2.com.tr), Lecturer (
>> http://www.cs.hacettepe.edu.tr/kisiler.html), JUG Leader (
>> http://www.ankarajug.org), Author (http://www.amazon.com/author/mert)
>>
>>
>>
>> On Friday 2 January 2015 at 11:51, Thomas Andraschko wrote:
>>
>> > Hey Romain,
>> >
>> > AFAIR the default for the render attribute of f:ajax is @none, so
>> therefore
>> > it's expected. You would need to set it to e.g. render="@form"
>> >
>> > 2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com
>> (mailto:rmannibucau@gmail.com)>:
>> >
>> > > Hi guys,
>> > >
>> > >
>> > > in cdi tcks there is:
>> > >
>> > > <h:form id="ajaxForm">
>> > > <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
>> > > id="conversationId" />
>> > > <h:inputText value="#{storm.strength}" id="stormStrength" />
>> > > <h:commandButton action="#{storm.beginConversation}"
>> > > value="Begin conversation" id="beginConversationButton">
>> > > <f:ajax render="@form" />
>> > > </h:commandButton>
>> > > <h:commandButton value="Thunder" id="thunderButton">
>> > > <f:ajax execute="stormStrength" />
>> > > <!-- Rerender the whole form - conversation id is part of form
>> > > action attribute -->
>> > > <!-- f:param name="cid"
>> > > value="#{javax.enterprise.context.conversation.id}" /-->
>> > > </h:commandButton>
>> > > </h:form>
>> > >
>> > > seems when ajax rendering is triggered h:inputHidden is not refresh,
>> > > is it expected?
>> > >
>> > >
>> > > Romain Manni-Bucau
>> > > @rmannibucau
>> > > http://www.tomitribe.com
>> > > http://rmannibucau.wordpress.com
>> > > https://github.com/rmannibucau
>> > >
>> >
>> >
>> >
>>
>>
>>

Re: hidden input not refreshed

Posted by Thomas Andraschko <an...@gmail.com>.
I see Romain. It should work for the first button...
You could try to add execute="@this" but it should work without, too.

2015-01-02 11:01 GMT+01:00 Mert ÇALIŞKAN <mc...@gmail.com>:

> Yes, default value of f:ajax is @none.
> But also by default the element that triggers the request, which is
> <h:commandButton> in your case, will get re-rendered (refreshed with your
> statement).
> so your inputHidden will not be updated unless specified.
>
> Cheers,
>
> M.
> ————
> Oracle Java Champion
> Developer (http://www.t2.com.tr), Lecturer (
> http://www.cs.hacettepe.edu.tr/kisiler.html), JUG Leader (
> http://www.ankarajug.org), Author (http://www.amazon.com/author/mert)
>
>
>
> On Friday 2 January 2015 at 11:51, Thomas Andraschko wrote:
>
> > Hey Romain,
> >
> > AFAIR the default for the render attribute of f:ajax is @none, so
> therefore
> > it's expected. You would need to set it to e.g. render="@form"
> >
> > 2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com
> (mailto:rmannibucau@gmail.com)>:
> >
> > > Hi guys,
> > >
> > >
> > > in cdi tcks there is:
> > >
> > > <h:form id="ajaxForm">
> > > <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
> > > id="conversationId" />
> > > <h:inputText value="#{storm.strength}" id="stormStrength" />
> > > <h:commandButton action="#{storm.beginConversation}"
> > > value="Begin conversation" id="beginConversationButton">
> > > <f:ajax render="@form" />
> > > </h:commandButton>
> > > <h:commandButton value="Thunder" id="thunderButton">
> > > <f:ajax execute="stormStrength" />
> > > <!-- Rerender the whole form - conversation id is part of form
> > > action attribute -->
> > > <!-- f:param name="cid"
> > > value="#{javax.enterprise.context.conversation.id}" /-->
> > > </h:commandButton>
> > > </h:form>
> > >
> > > seems when ajax rendering is triggered h:inputHidden is not refresh,
> > > is it expected?
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau
> > > http://www.tomitribe.com
> > > http://rmannibucau.wordpress.com
> > > https://github.com/rmannibucau
> > >
> >
> >
> >
>
>
>

Re: hidden input not refreshed

Posted by Mert ÇALIŞKAN <mc...@gmail.com>.
Yes, default value of f:ajax is @none.
But also by default the element that triggers the request, which is <h:commandButton> in your case, will get re-rendered (refreshed with your statement).
so your inputHidden will not be updated unless specified.

Cheers,

M.
————
Oracle Java Champion
Developer (http://www.t2.com.tr), Lecturer (http://www.cs.hacettepe.edu.tr/kisiler.html), JUG Leader (http://www.ankarajug.org), Author (http://www.amazon.com/author/mert)



On Friday 2 January 2015 at 11:51, Thomas Andraschko wrote:

> Hey Romain,
>  
> AFAIR the default for the render attribute of f:ajax is @none, so therefore
> it's expected. You would need to set it to e.g. render="@form"
>  
> 2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com (mailto:rmannibucau@gmail.com)>:
>  
> > Hi guys,
> >  
> >  
> > in cdi tcks there is:
> >  
> > <h:form id="ajaxForm">
> > <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
> > id="conversationId" />
> > <h:inputText value="#{storm.strength}" id="stormStrength" />
> > <h:commandButton action="#{storm.beginConversation}"
> > value="Begin conversation" id="beginConversationButton">
> > <f:ajax render="@form" />
> > </h:commandButton>
> > <h:commandButton value="Thunder" id="thunderButton">
> > <f:ajax execute="stormStrength" />
> > <!-- Rerender the whole form - conversation id is part of form
> > action attribute -->
> > <!-- f:param name="cid"
> > value="#{javax.enterprise.context.conversation.id}" /-->
> > </h:commandButton>
> > </h:form>
> >  
> > seems when ajax rendering is triggered h:inputHidden is not refresh,
> > is it expected?
> >  
> >  
> > Romain Manni-Bucau
> > @rmannibucau
> > http://www.tomitribe.com
> > http://rmannibucau.wordpress.com
> > https://github.com/rmannibucau
> >  
>  
>  
>  



Re: hidden input not refreshed

Posted by Romain Manni-Bucau <rm...@gmail.com>.
that's what is done (beginConversationButton):

  <f:ajax render="@form" />


Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2015-01-02 10:51 GMT+01:00 Thomas Andraschko <an...@gmail.com>:
> Hey Romain,
>
> AFAIR the default for the render attribute of f:ajax is @none, so therefore
> it's expected. You would need to set it to e.g. render="@form"
>
> 2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> Hi guys,
>>
>>
>> in cdi tcks there is:
>>
>> <h:form id="ajaxForm">
>>  <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
>> id="conversationId" />
>>  <h:inputText value="#{storm.strength}" id="stormStrength" />
>>  <h:commandButton action="#{storm.beginConversation}"
>>   value="Begin conversation" id="beginConversationButton">
>>   <f:ajax render="@form" />
>>  </h:commandButton>
>>  <h:commandButton value="Thunder" id="thunderButton">
>>   <f:ajax execute="stormStrength" />
>>   <!-- Rerender the whole form - conversation id is part of form
>> action attribute -->
>>   <!-- f:param name="cid"
>> value="#{javax.enterprise.context.conversation.id}" /-->
>>  </h:commandButton>
>> </h:form>
>>
>> seems when ajax rendering is triggered h:inputHidden is not refresh,
>> is it expected?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>

Re: hidden input not refreshed

Posted by Thomas Andraschko <an...@gmail.com>.
Hey Romain,

AFAIR the default for the render attribute of f:ajax is @none, so therefore
it's expected. You would need to set it to e.g. render="@form"

2015-01-02 10:33 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hi guys,
>
>
> in cdi tcks there is:
>
> <h:form id="ajaxForm">
>  <h:inputHidden value="#{javax.enterprise.context.conversation.id}"
> id="conversationId" />
>  <h:inputText value="#{storm.strength}" id="stormStrength" />
>  <h:commandButton action="#{storm.beginConversation}"
>   value="Begin conversation" id="beginConversationButton">
>   <f:ajax render="@form" />
>  </h:commandButton>
>  <h:commandButton value="Thunder" id="thunderButton">
>   <f:ajax execute="stormStrength" />
>   <!-- Rerender the whole form - conversation id is part of form
> action attribute -->
>   <!-- f:param name="cid"
> value="#{javax.enterprise.context.conversation.id}" /-->
>  </h:commandButton>
> </h:form>
>
> seems when ajax rendering is triggered h:inputHidden is not refresh,
> is it expected?
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>