lundi 11 juillet 2016

JQuery masked input in JSF inputText

I have some issues in making an alphanumeric mask in JSF inputText field. This is my field:

<h:inputText
    id="MyID#{i}"
    styleClass="width50 siBorder"
    value="#{myBean.propery.get(i).info}"
    required="false">
</h:inputText>

This is my jQuery

<script type="text/javascript">
                jQuery(document).ready(function(){
                jQuery(document.getElementById('form:MyID_0')).mask('ZZZ-ZZ-ZZZZ', {translation: {
                   Z: {pattern: /[A-Za-z0-9]/}                                      }
                                }); 
                });
</script>

With this mask, when i click on the textfield 'ZZZ-ZZ-ZZZZ' appear inside the textfield and i cannot modify it. If i use the default mask

mask('99/99/9999',{placeholder:' '});

everything work find. But the pattern is only numeric and i need alphanumerical pattern.

Any idea why it behaves like this?

Aucun commentaire:

Enregistrer un commentaire