Display text at top of form based on ID
AnsweredI am trying to determine how I can display certain text at the top of a form based on which form it is. We've decided to hide the form drop-down due to the number we have but want to make sure the end-user remembers which form they are on.
Anyone know the easiest way to accomplish this?
-
Hi @Rob H.,
If you are using Copenhagen Theme, then go to line no. 8 in your new_request_page.hbs and replace the code line no.8 to line no. 15 with -
<h1 class="form-title">
{{t 'submit_a_request'}}
{{#if follow_up}}
<span class="follow-up-hint">
{{follow_up}}
</span>
{{/if}}
</h1>Paste the below script at the bottom of your new_request_page.hbs template -
<script>
var id = window.location.href.match(/[0-9]+/)[0];
if ( id == 'FORM_ID' ) { // Make sure to replace FORM_ID with your request form ID.
$('.form-title').text('TITLE_FOR_FORM'); // Replace it with the title you want
}
</script>Let me know how it goes for you.
Thanks
Trapta
Team Diziana
-
Hi @Trapta,
This is great. Thank you.
It seems to be working fine except for when I try to use Dynamic Content for the title. Is that something that's possible with different formatting?
-
Yes @Rob, that is possible. Simply put the DC in text(DC).
Thanks
Trapta -
Hmm, I get an error when inserting the DC placeholder in the parenthesis.
<script>
var id = window.location.href.match(/[0-9]+/)[0];
if ( id == '360001300473' ) {
$('.form-title').text('{{dc.placeholder}}');
}
</script> -
@Rob, that's because when you use DC in the help center, the syntax should be {{dc 'placeholder'}} instead of {{dc.placeholder}}.
Give it a shot and let me know how it goes for you.
Thanks
Trapta
Team Diziana
-
@Trapta, ah..that's right. Thank you. It's all displaying properly for us now.
Please sign in to leave a comment.
6 Comments