Could someone please tell me how can I update the value of outputText via. Java Scripts. I have this huge dynamic datagrid, with many columns two of which are to enter pin numbers per row (enter pin & reEnter Pin).
I made a Java Script for the onchange event of the reEnter Pin, that compares its value with the enter Pin. In case the values are not the same I need an indication on that row : "*" in bold red, to indicate that the values are not correct.
Alternately , I tried using ValueChangeListener, but it didnot work as well.
I am assuming you are already doing the below.
What you might be missing is the place holder for the '*'. For this you have to create a 'DIV' element. Usually this can be created directly by having h:outputText with "ID" attribute. Set the style for this 'DIV' element to 'display:none' initially. Now in your onchange() / onBlur() function, you could have the function that sets the styple
Note - This can be done easily if you have consistent naming for the field values. A sample example is as below. You would have to replace the parameters appropriately if you plan to use this function below.
If you would like to try it out in JSF, you can use a validator method in your backing bean. Set the rendered attribute of outputText '*' to true if the validation fails. You may want to bind the enter pin and the reenter pin inputText elements as well as outputText element to backing bean properties in order to access them in your validator method.
I have this huge dynamic datagrid, with many columns two of which are to enter pin numbers per row (enter pin & reEnter Pin).
Do you mean that you have these enter pin elements in every row? If so you may also need to bind the datagrid to a backing bean property in order to loop through the rows. Hope this gives you some idea.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop