1

I have one inputbox 'percentage' and one outputbox 'Amount' in datatable. now i want to auto populate Amount when i enter percentage -like say i enter 10 in percentage then Amount should be populated TotalAmount*10/100,and also update 'creditControlTermModel.amount' this value accordingly

<hx:dataTableEx border="0" value="#{client.creditControlList}"
    var="creditControlTermModel">
<hx:columnEx id="ColumnEx5">
    <f:facet name="header">
        <h:outputText value="Percentage"
            styleClass="outputText" id="48"></h:outputText>
    </f:facet>
    <h:inputText styleClass="inputText" id="creditControltext64Input" size="10" 
        value="#{creditControlTermModel.percentage}" ></h:inputText>
</hx:columnEx>
<hx:columnEx id="columnEx6">
    <f:facet name="header">
        <h:outputText value="Amount"
            styleClass="outputText" id="AmtHdr"></h:outputText>
    </f:facet>
    <h:outputText styleClass="outputText" id="TxtOut"
        value="#{creditControlTermModel.amount}" ></h:outputText>
</hx:columnEx>

Please suggest how to do it. I tried using

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Vksgh
  • 91
  • 6
  • Put it all into a form. You also need a submit button or AJAX extensions. – Hubert Grzeskowiak Oct 17 '16 at 14:42
  • @HubertGrzeskowiak Thanks HUbert for looking into it.how Ajax extension will help me to auto populate the OutPuttext? – Vksgh Oct 18 '16 at 07:37
  • To send data to the server and get the calculated value back, you need to run a JSF cycle. That cycle requires a new server request and response. You can do that using usual HTTP GET or POST (classic form) or using AJAX, in which case the page is only partially reloaded. Please look into some web tutorials about the topic for examples and documentation. You also might want to try out PrimeFaces, which implements AJAX functionality into native components nicely. – Hubert Grzeskowiak Oct 18 '16 at 08:26
  • @HubertGrzeskowiak thanks Hubert.BUt I need to populate it simultaneously as happens in on key press or data binding not on submit – Vksgh Oct 18 '16 at 09:00
  • Then either make your own logic in pure client-side JS, or bind the ajax re-rendering to a keyboard/input event – Hubert Grzeskowiak Oct 18 '16 at 09:13
  • @HubertGrzeskowiak i tried with js then ui is getting updated but BIND javaobject value not getting updated. I will surely try ajax re-rendering suggestion and let you know.thanks for help – Vksgh Oct 18 '16 at 09:46

0 Answers0