Changing the {{t 'submit_a_request'}} to the form title
I am working on the guide for our business and I am looking to change the title on the requests/new page I want it to show the title for the form in place of the {{t 'submit_a_request'}}.
Any help is greatly appreciated!
-
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
-
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 theirI believe the issue is the claim type as its picking that up as it is also a nested input?
-
Managed to fix it using the following
var getText = $('.request_ticket_form_id .nesty-input').text();
-
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.
-
Hi Ifra Saqlain, I'm trying to edit the title on my form and followed the steps above, but it doesn't seem to be showing the title on the Form. I want to change the 'Submit a request' to 'Submit feedback'.
I see the title as it's loading and then the form's tip covers it. Did I enter the code in the right place?
-
Hi Joanne Giang, you added the title on right place, may be there is some CSS issue because you are using Bootstrap classes so it covers the title.
You can inspect the form using dev tool.
Please sign in to leave a comment.
6 Comments