Changing the {{t 'submit_a_request'}} to the form title

4 Comments

  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hey Chris,  you want to show your current form name as a title instead of Submit a request, so you have to add this simple two-line script code to your script.js file.

     

    1). Add jQuery Library to your document_head.hbs file.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    Screenshot for the same:

     

    2). Go to your script.js file and paste it at the bottom.

    $(document).ready(function(){

    var getText = $('.nesty-input').text();
    $('.new-req-title').html(getText)

    });

     

    Screenshot for the same:

    3). Go to your new_request_page.hbs file, add div with the class-name and remove {{t 'submit_a_request'}}.


     

     

     

     

     

     Solution with only JavaScript code:

     

    1). Go to your script.js file and paste only given two lines code at the bottom but under the DOM function.

    var getText = document.querySelector('.nesty-input').innerText;
    document.querySelector('.new-req-title').innerText = getText;

     Screenshot for the same:

     

    2). Go to your new_request_page.hbs file, add div with the class-name and remove {{t 'submit_a_request'}}.

     

    Output is:

     

     

     

     

    If any confusion, do let me know :)

    Thanks

    Team Diziana

     

    2
  • Chris Fewster

    Ifra Saqlain

    I have done that and one form looks fine but on another its added a "-" into the name of the form which I have checked on admin and its all correct their

     

    I believe the issue is the claim type as its picking that up as it is also a nested input?

    0
  • Chris Fewster

    Managed to fix it using the following 

     

    var getText = $('.request_ticket_form_id .nesty-input').text();

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    I don't have that kind of field in my forms, so I couldn't see that, but no worries, you have fixed it now.

    Fixing with parent class-name:

     

    But happy to see that your main purpose with the title of the forms is working.

    1

Please sign in to leave a comment.

Powered by Zendesk