Then Inputtext lost mask when Edit information, what´s wrong?How can I know the id of a JSF component so I can use in JavascriptUIForm with prependId=“false” breaks <f:ajax render>List of components implementing NamingContainerJSF ui:repeat and f:ajax giving wrong value for h:inputText after rerendera4j:commandLink is erasing javascript from xhtmlh:commandButtoon and f:ajax does not render a h:dataTable if no action property is providedInputText inside Primefaces dataTable is not refreshedHide inputText on lost focus with p:inplaceJSF Setter method not working in inputText formPrimefaces form field requiredMessage shows twiceEditable dataTable with inputText<p:inputText> values not updating(How) Can one obtain the value of a UIInput via an AjaxBeahviorEvent for a changed inputText

Gift for mentor after his thesis defense?

Identity of a supposed anonymous referee revealed through "Description" of the report

How is Arya still alive?

Do oversize pulley wheels increase derailleur capacity?

How to avoid making self and former employee look bad when reporting on fixing former employee's work?

My perfect evil overlord plan... or is it?

Opposite party turned away from voting when ballot is all opposing party

logo selection for poster presentation

Did any early RISC OS precursor run on the BBC Micro?

Can you turn a recording upside-down?

What dice to use in a game that revolves around triangles?

Was Mohammed the most popular first name for boys born in Berlin in 2018?

Would the rotation of the starfield from a ring station be too disorienting?

How can one see if an address is multisig?

How to start your Starctaft II games vs AI immediatly?

How to append code verbatim to .bashrc?

How do I calculate my to-hit bonus when using the Great Weapon Master feat?

What happens when the drag force exceeds the weight of an object falling into earth?

My Sixteen Friendly Students

Light Switch Neutrals: Bundle all together?

Are there vaccine ingredients which may not be disclosed ("hidden", "trade secret", or similar)?

Why doesn't increasing the temperature of something like wood or paper set them on fire?

Why did Missandei say this?

And now you see it II (the B side)



Then Inputtext lost mask when Edit information, what´s wrong?


How can I know the id of a JSF component so I can use in JavascriptUIForm with prependId=“false” breaks <f:ajax render>List of components implementing NamingContainerJSF ui:repeat and f:ajax giving wrong value for h:inputText after rerendera4j:commandLink is erasing javascript from xhtmlh:commandButtoon and f:ajax does not render a h:dataTable if no action property is providedInputText inside Primefaces dataTable is not refreshedHide inputText on lost focus with p:inplaceJSF Setter method not working in inputText formPrimefaces form field requiredMessage shows twiceEditable dataTable with inputText<p:inputText> values not updating(How) Can one obtain the value of a UIInput via an AjaxBeahviorEvent for a changed inputText






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I need show the mask in InputText field after click in hiperlink for Edit information in my FORM.
When I access the form in first time the inputext fields show me the masks correctly.



Follow my code:



 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>

<label for="inputcpf">CPF</label>
<h:inputText class="form-control" required="false" value="#clienteBean.cliente.cpf" id="inputcpf" requiredMessage="Informe o CPF do cliente." pl:placeholder="Informe o CPF" />

<script type="text/javascript">
$("#inputcpf").mask("999.999.999-99");
</script>


And the EDIT part of code:



 <p:column style="width:260px;" headerText="Nome" >
<f:ajax event="click" execute="@this" render="@form" listener="#clienteBean.preparaAlteracao">
<h:commandLink value="#dados.nome">
<f:param name="id" value="#dados.id" />
</h:commandLink>
</f:ajax>
</p:column>


After clicking on the link the data is loaded in the fields but the field with mask does not display the mask










share|improve this question






















  • Does it instead show the placeholder Informe o CPF?

    – Selaron
    Mar 23 at 6:14

















1















I need show the mask in InputText field after click in hiperlink for Edit information in my FORM.
When I access the form in first time the inputext fields show me the masks correctly.



Follow my code:



 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>

<label for="inputcpf">CPF</label>
<h:inputText class="form-control" required="false" value="#clienteBean.cliente.cpf" id="inputcpf" requiredMessage="Informe o CPF do cliente." pl:placeholder="Informe o CPF" />

<script type="text/javascript">
$("#inputcpf").mask("999.999.999-99");
</script>


And the EDIT part of code:



 <p:column style="width:260px;" headerText="Nome" >
<f:ajax event="click" execute="@this" render="@form" listener="#clienteBean.preparaAlteracao">
<h:commandLink value="#dados.nome">
<f:param name="id" value="#dados.id" />
</h:commandLink>
</f:ajax>
</p:column>


After clicking on the link the data is loaded in the fields but the field with mask does not display the mask










share|improve this question






















  • Does it instead show the placeholder Informe o CPF?

    – Selaron
    Mar 23 at 6:14













1












1








1








I need show the mask in InputText field after click in hiperlink for Edit information in my FORM.
When I access the form in first time the inputext fields show me the masks correctly.



Follow my code:



 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>

<label for="inputcpf">CPF</label>
<h:inputText class="form-control" required="false" value="#clienteBean.cliente.cpf" id="inputcpf" requiredMessage="Informe o CPF do cliente." pl:placeholder="Informe o CPF" />

<script type="text/javascript">
$("#inputcpf").mask("999.999.999-99");
</script>


And the EDIT part of code:



 <p:column style="width:260px;" headerText="Nome" >
<f:ajax event="click" execute="@this" render="@form" listener="#clienteBean.preparaAlteracao">
<h:commandLink value="#dados.nome">
<f:param name="id" value="#dados.id" />
</h:commandLink>
</f:ajax>
</p:column>


After clicking on the link the data is loaded in the fields but the field with mask does not display the mask










share|improve this question














I need show the mask in InputText field after click in hiperlink for Edit information in my FORM.
When I access the form in first time the inputext fields show me the masks correctly.



Follow my code:



 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>

<label for="inputcpf">CPF</label>
<h:inputText class="form-control" required="false" value="#clienteBean.cliente.cpf" id="inputcpf" requiredMessage="Informe o CPF do cliente." pl:placeholder="Informe o CPF" />

<script type="text/javascript">
$("#inputcpf").mask("999.999.999-99");
</script>


And the EDIT part of code:



 <p:column style="width:260px;" headerText="Nome" >
<f:ajax event="click" execute="@this" render="@form" listener="#clienteBean.preparaAlteracao">
<h:commandLink value="#dados.nome">
<f:param name="id" value="#dados.id" />
</h:commandLink>
</f:ajax>
</p:column>


After clicking on the link the data is loaded in the fields but the field with mask does not display the mask







jsf primefaces jquery-inputmask






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 20:47









Mauricio SanchesMauricio Sanches

1614




1614












  • Does it instead show the placeholder Informe o CPF?

    – Selaron
    Mar 23 at 6:14

















  • Does it instead show the placeholder Informe o CPF?

    – Selaron
    Mar 23 at 6:14
















Does it instead show the placeholder Informe o CPF?

– Selaron
Mar 23 at 6:14





Does it instead show the placeholder Informe o CPF?

– Selaron
Mar 23 at 6:14












2 Answers
2






active

oldest

votes


















3














The mask is displayed as soon as you focus the input.
You likely have the input embedded into a h:form like this:



<h:form id="myForm">
<h:inputText ... id="inputcpf" .../>
</h:form>


The form id is prepended to the rendered input id in client side html:



<input id="myForm:inputcpf" ...>


Therefore your jQuery selector should look like this:



$("#myForm\:inputcpf")


You can find out more about the client id in How can I know the id of a JSF component so I can use in Javascript. If your client id does not contain the id of the parent form as a prefix (or any other NamingContainer), then you most likely are using prependId="false" which should be prevented of being used for reasons described in UIForm with prependId="false" breaks <f:ajax render>



But the easiest and most stable way to get a masked input in your case would be to use the PrimeFaces component <p:inputMask/>. Using your current approach the mask is lost as soon as you update the input using AJAX. You'd have to also update the script element in order to execute the mask function again and have a mask on the updated input.






share|improve this answer
































    0














    I change my code by primefaces codes. Follow !



     <h:form id="form">
    <h:inputHidden value="#userBean.user.id" />
    <p:inputText required="true" value="#userBean.user.name" id="inputName" />
    <p:inputMask mask="(99)99999-9999" value="#userBean.user.phone" id="inputPhone" >
    <p:keyFilter regEx="/[a-z0-9_]/i"/>
    </p:inputMask>
    <p:commandButton value="Save" update="@form" process="@form" actionListener="#userBean.saveUser" />


    I save the user and refresh all page... The new user is insert in datatable list.
    Then I have the dataTable with all users...



    Next step I need click in Edit link for edit the informations... and in this moment the data is populated in fields but the field lost de mask in input field.



     <p:dataTable id="list_users" var="dados" value="#userBean.allUsers">
    <p:column>
    <f:facet name="header">ID</f:facet>
    <h:outputText value="#dados.id" />
    </p:column>
    <p:column>
    <f:facet name="header">Name</f:facet>
    <h:outputText value="#dados.name" />
    </p:column>
    <p:column headerText="Ação">
    <f:facet name="header">Ação</f:facet>
    <f:ajax event="click" render="@form" listener="#userBean.editUser">
    <h:commandLink>
    <f:param name="id" value="#dados.id" />
    <h:outputText value="edit" />
    </h:commandLink>
    </f:ajax>
    </p:column>
    </dataTable>





    share|improve this answer























    • This is not an answer to your question...

      – Kukeltje
      Mar 27 at 22:22











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307557%2fthen-inputtext-lost-mask-when-edit-information-what%25c2%25b4s-wrong%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    The mask is displayed as soon as you focus the input.
    You likely have the input embedded into a h:form like this:



    <h:form id="myForm">
    <h:inputText ... id="inputcpf" .../>
    </h:form>


    The form id is prepended to the rendered input id in client side html:



    <input id="myForm:inputcpf" ...>


    Therefore your jQuery selector should look like this:



    $("#myForm\:inputcpf")


    You can find out more about the client id in How can I know the id of a JSF component so I can use in Javascript. If your client id does not contain the id of the parent form as a prefix (or any other NamingContainer), then you most likely are using prependId="false" which should be prevented of being used for reasons described in UIForm with prependId="false" breaks <f:ajax render>



    But the easiest and most stable way to get a masked input in your case would be to use the PrimeFaces component <p:inputMask/>. Using your current approach the mask is lost as soon as you update the input using AJAX. You'd have to also update the script element in order to execute the mask function again and have a mask on the updated input.






    share|improve this answer





























      3














      The mask is displayed as soon as you focus the input.
      You likely have the input embedded into a h:form like this:



      <h:form id="myForm">
      <h:inputText ... id="inputcpf" .../>
      </h:form>


      The form id is prepended to the rendered input id in client side html:



      <input id="myForm:inputcpf" ...>


      Therefore your jQuery selector should look like this:



      $("#myForm\:inputcpf")


      You can find out more about the client id in How can I know the id of a JSF component so I can use in Javascript. If your client id does not contain the id of the parent form as a prefix (or any other NamingContainer), then you most likely are using prependId="false" which should be prevented of being used for reasons described in UIForm with prependId="false" breaks <f:ajax render>



      But the easiest and most stable way to get a masked input in your case would be to use the PrimeFaces component <p:inputMask/>. Using your current approach the mask is lost as soon as you update the input using AJAX. You'd have to also update the script element in order to execute the mask function again and have a mask on the updated input.






      share|improve this answer



























        3












        3








        3







        The mask is displayed as soon as you focus the input.
        You likely have the input embedded into a h:form like this:



        <h:form id="myForm">
        <h:inputText ... id="inputcpf" .../>
        </h:form>


        The form id is prepended to the rendered input id in client side html:



        <input id="myForm:inputcpf" ...>


        Therefore your jQuery selector should look like this:



        $("#myForm\:inputcpf")


        You can find out more about the client id in How can I know the id of a JSF component so I can use in Javascript. If your client id does not contain the id of the parent form as a prefix (or any other NamingContainer), then you most likely are using prependId="false" which should be prevented of being used for reasons described in UIForm with prependId="false" breaks <f:ajax render>



        But the easiest and most stable way to get a masked input in your case would be to use the PrimeFaces component <p:inputMask/>. Using your current approach the mask is lost as soon as you update the input using AJAX. You'd have to also update the script element in order to execute the mask function again and have a mask on the updated input.






        share|improve this answer















        The mask is displayed as soon as you focus the input.
        You likely have the input embedded into a h:form like this:



        <h:form id="myForm">
        <h:inputText ... id="inputcpf" .../>
        </h:form>


        The form id is prepended to the rendered input id in client side html:



        <input id="myForm:inputcpf" ...>


        Therefore your jQuery selector should look like this:



        $("#myForm\:inputcpf")


        You can find out more about the client id in How can I know the id of a JSF component so I can use in Javascript. If your client id does not contain the id of the parent form as a prefix (or any other NamingContainer), then you most likely are using prependId="false" which should be prevented of being used for reasons described in UIForm with prependId="false" breaks <f:ajax render>



        But the easiest and most stable way to get a masked input in your case would be to use the PrimeFaces component <p:inputMask/>. Using your current approach the mask is lost as soon as you update the input using AJAX. You'd have to also update the script element in order to execute the mask function again and have a mask on the updated input.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 23 at 7:34









        Kukeltje

        9,43541439




        9,43541439










        answered Mar 23 at 7:00









        SelaronSelaron

        3,14211828




        3,14211828























            0














            I change my code by primefaces codes. Follow !



             <h:form id="form">
            <h:inputHidden value="#userBean.user.id" />
            <p:inputText required="true" value="#userBean.user.name" id="inputName" />
            <p:inputMask mask="(99)99999-9999" value="#userBean.user.phone" id="inputPhone" >
            <p:keyFilter regEx="/[a-z0-9_]/i"/>
            </p:inputMask>
            <p:commandButton value="Save" update="@form" process="@form" actionListener="#userBean.saveUser" />


            I save the user and refresh all page... The new user is insert in datatable list.
            Then I have the dataTable with all users...



            Next step I need click in Edit link for edit the informations... and in this moment the data is populated in fields but the field lost de mask in input field.



             <p:dataTable id="list_users" var="dados" value="#userBean.allUsers">
            <p:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#dados.id" />
            </p:column>
            <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#dados.name" />
            </p:column>
            <p:column headerText="Ação">
            <f:facet name="header">Ação</f:facet>
            <f:ajax event="click" render="@form" listener="#userBean.editUser">
            <h:commandLink>
            <f:param name="id" value="#dados.id" />
            <h:outputText value="edit" />
            </h:commandLink>
            </f:ajax>
            </p:column>
            </dataTable>





            share|improve this answer























            • This is not an answer to your question...

              – Kukeltje
              Mar 27 at 22:22















            0














            I change my code by primefaces codes. Follow !



             <h:form id="form">
            <h:inputHidden value="#userBean.user.id" />
            <p:inputText required="true" value="#userBean.user.name" id="inputName" />
            <p:inputMask mask="(99)99999-9999" value="#userBean.user.phone" id="inputPhone" >
            <p:keyFilter regEx="/[a-z0-9_]/i"/>
            </p:inputMask>
            <p:commandButton value="Save" update="@form" process="@form" actionListener="#userBean.saveUser" />


            I save the user and refresh all page... The new user is insert in datatable list.
            Then I have the dataTable with all users...



            Next step I need click in Edit link for edit the informations... and in this moment the data is populated in fields but the field lost de mask in input field.



             <p:dataTable id="list_users" var="dados" value="#userBean.allUsers">
            <p:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#dados.id" />
            </p:column>
            <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#dados.name" />
            </p:column>
            <p:column headerText="Ação">
            <f:facet name="header">Ação</f:facet>
            <f:ajax event="click" render="@form" listener="#userBean.editUser">
            <h:commandLink>
            <f:param name="id" value="#dados.id" />
            <h:outputText value="edit" />
            </h:commandLink>
            </f:ajax>
            </p:column>
            </dataTable>





            share|improve this answer























            • This is not an answer to your question...

              – Kukeltje
              Mar 27 at 22:22













            0












            0








            0







            I change my code by primefaces codes. Follow !



             <h:form id="form">
            <h:inputHidden value="#userBean.user.id" />
            <p:inputText required="true" value="#userBean.user.name" id="inputName" />
            <p:inputMask mask="(99)99999-9999" value="#userBean.user.phone" id="inputPhone" >
            <p:keyFilter regEx="/[a-z0-9_]/i"/>
            </p:inputMask>
            <p:commandButton value="Save" update="@form" process="@form" actionListener="#userBean.saveUser" />


            I save the user and refresh all page... The new user is insert in datatable list.
            Then I have the dataTable with all users...



            Next step I need click in Edit link for edit the informations... and in this moment the data is populated in fields but the field lost de mask in input field.



             <p:dataTable id="list_users" var="dados" value="#userBean.allUsers">
            <p:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#dados.id" />
            </p:column>
            <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#dados.name" />
            </p:column>
            <p:column headerText="Ação">
            <f:facet name="header">Ação</f:facet>
            <f:ajax event="click" render="@form" listener="#userBean.editUser">
            <h:commandLink>
            <f:param name="id" value="#dados.id" />
            <h:outputText value="edit" />
            </h:commandLink>
            </f:ajax>
            </p:column>
            </dataTable>





            share|improve this answer













            I change my code by primefaces codes. Follow !



             <h:form id="form">
            <h:inputHidden value="#userBean.user.id" />
            <p:inputText required="true" value="#userBean.user.name" id="inputName" />
            <p:inputMask mask="(99)99999-9999" value="#userBean.user.phone" id="inputPhone" >
            <p:keyFilter regEx="/[a-z0-9_]/i"/>
            </p:inputMask>
            <p:commandButton value="Save" update="@form" process="@form" actionListener="#userBean.saveUser" />


            I save the user and refresh all page... The new user is insert in datatable list.
            Then I have the dataTable with all users...



            Next step I need click in Edit link for edit the informations... and in this moment the data is populated in fields but the field lost de mask in input field.



             <p:dataTable id="list_users" var="dados" value="#userBean.allUsers">
            <p:column>
            <f:facet name="header">ID</f:facet>
            <h:outputText value="#dados.id" />
            </p:column>
            <p:column>
            <f:facet name="header">Name</f:facet>
            <h:outputText value="#dados.name" />
            </p:column>
            <p:column headerText="Ação">
            <f:facet name="header">Ação</f:facet>
            <f:ajax event="click" render="@form" listener="#userBean.editUser">
            <h:commandLink>
            <f:param name="id" value="#dados.id" />
            <h:outputText value="edit" />
            </h:commandLink>
            </f:ajax>
            </p:column>
            </dataTable>






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 27 at 20:44









            Mauricio SanchesMauricio Sanches

            1614




            1614












            • This is not an answer to your question...

              – Kukeltje
              Mar 27 at 22:22

















            • This is not an answer to your question...

              – Kukeltje
              Mar 27 at 22:22
















            This is not an answer to your question...

            – Kukeltje
            Mar 27 at 22:22





            This is not an answer to your question...

            – Kukeltje
            Mar 27 at 22:22

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55307557%2fthen-inputtext-lost-mask-when-edit-information-what%25c2%25b4s-wrong%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현