Sunday 15 July 2012

jsf - Concatenate Date objects onclick of h:commandButton -


I am using Primefaces 3.1.1. And in general is very new to JSF. I have two calendar input fields on my form like:

  & lt; P: calendar widgetVar = "widgetFromDate" id = "ID1" value = "# {selected from .ben.frame}" pattern = "Dd.MM.yyyy" mode = "popup" showOn = "button" & gt; & Lt; / P: Calendar & gt; & Lt; P: calendar widgetVar = "widgetFromTime" id = "id2" value = "# {been. Selected}" pattern = "hh: mm" timeOnly = "right" mode = "popup" showon = "button" & gt; ; & Lt; / P: Calendar & gt;   

I have a third area, which adds and displays the above two values ​​at the click of h: commandButton .

For example:

button:

  & lt; H: Command button value = "Speakrun" onclic = "????" & Gt; & Lt; / H: CommandButton & gt;   

I'm not sure exactly how this completes. Is there any possibility of using some Ajax incidents? Any sign will be greatly appreciated.

-BR

Just basically like this:

 < Code> & lt; P: calendar ... value = "# {bean.date1}" /> & Lt; P: calendar ... value = "# {bean.date2}" /> & Lt; P: command button value = "submit" action = "# {bean.submit}" update = "results" /> & Lt; H: outputText id = "result" value = "# {bean.date3}" /> With   

  public void submit () {date3 = mergeSomehow (date1, date2); }   

Or if you insist on using the standard JSF command button, then it has the same effect:

  & lt; H: commandButton value = "submit" action = "# {bean.submit}" & gt; & Lt; F: Ajax execution = "@form" render = "results" /> & Lt; / H: CommandButton & gt;   

The merger implementation details are up to you and not in any way related to JSF / PrimeFaces. If you get stacks, then just ask a basic question.

For this code, at least inadvertently there is onclick , because it is only a hook in this special case, being presented, you are not interested in this hook.

No comments:

Post a Comment