1

I want to get the values in vaccineDate on onchange function using JavaScript.
here is the Code of xHTML file

xmlns:p="http://primefaces.org/ui"

<p:inputMask id="vaccineDate" value="#petRepositoryImpl.petView.petHealth.vaccineDate}" mask="99/99/9999" style="width:200px;"/>
<p:message id="vaccineDateMsg" for="vaccineDate" display="text" />

I have tried to get the values using

document.getElementById("vaccineDate").value

but it failed..!!Can anyone help..!

This is the HTML Code for the above block and i don't SEE A VALID ID.

<td><input id="tabView:vaccineDate" name="tabView:vaccineDate" type="text" value="" style="width:200px;" class="ui-inputfield ui-inputmask ui-widget ui-state-default ui-corner-all" /><script id="tabView:vaccineDate_s" type="text/javascript">PrimeFaces.cw('InputMask','widget_tabView_vaccineDate',{id:'tabView:vaccineDate',mask:'99/99/9999',behaviors:{blur:function(event) {PrimeFaces.ab({source:'tabView:vaccineDate',event:'blur',process:'tabView:vaccineDate',update:'tabView:vaccineDate'}, arguments[1]);}}});</script></td>

Honestly, I don't know what this id="tabView:vaccineDate" means.!!

Please help.

Dileep
  • 5,362
  • 3
  • 22
  • 38
  • 1
    Why are you focusing so much on JSF source code instead of its generated HTML output while JavaScript runs in client side, working on HTML DOM tree? To get better answers from JavaScript users, please reframe your question in such way that you show only the JSF-generated HTML output instead of JSF source code. For starters, just rightclick page in your webbrowser, do *View Source* and copypaste/simplify the relevant part and remove the JSF tags/noise from your question as they are not relevant anymore. In the meanwhile, I strongly recommend to take a JSF pause and learn basic HTML/JS. – BalusC Jul 24 '13 at 13:19
  • possible duplicate of [How can I know the id of a JSF component so I can use in Javascript](http://stackoverflow.com/questions/6045307/how-can-i-know-the-id-of-a-jsf-component-so-i-can-use-in-javascript) – BalusC Jul 24 '13 at 13:19
  • 1
    As per your unnecessarily panicked edit: that's just the actual ID of the element in the HTML document. Didn't it occur to you that you should use exactly that ID in `getElemenyById()`? Please carefully read the duplicate question link. I would really strongly recommend to take a JSF pause and learn basic HTML/JS. If you don't understand anything of the basic concepts HTTP, HTML, JS, Java, Servlets, then JSF will be so much harder to understand. – BalusC Jul 25 '13 at 12:01

0 Answers0