Forms, input fields and member details in hidden fields

Hi and thanks in advance,

My content within ghost for free subscribers comes in the form of interactive forms vs static written content. I use tally.so for my forms.

I simply want to make sure that every free subscriber who is logged in does not have to fill out their name and email address every-time they fill in the form to get a respondent notification (sent by tally).

So the tally form somehow grabs their name and email address from ghost and inputs into a hidden fields in tally.so (form tool) and then send them the results of how they went/answered.

I understand ghost have attributes: @member.email @member.name but i just don’t understand how they feed into the hidden fields and how it works.

Thanks again,

Rogue

Based on the kb here:

It looks like you need to add something like this to your theme:

<iframe src="https://tally.so/embed/nPdDxn?{{#if @member.name}}name={{@member.name}}&{{/if}}{{if @member.email}}email={{@member.email}}{{/if}}" ... />

If you’re trying to do it with code injection, you’ll have to fetch the member data, something like this (not tested):

<script>
async function updateUrl(iframeElement) {
  const {name, email} = await fetch('/members/api/member').then(r => r.json());
  const currentUrl = new URL(iframeElement.src);
  if (name) {
    currentUrl.searchParams.set('name', name);
  }

  if (email) {
    currentUrl.searchParams.set('email', email);
  }

  iframeElement.src = currentUrl.toString();
}

updateUrl(document.querySelector('iframe[src^="https://tally.so"]'));
</script>

Thank you so much for helping out. Your code with the form ref 3Ek1vX brings up an error on the test page: See if member details parse on in a tally form

I also have tried the following two embeds and whilst they show up, they do now input the member name or member email into the hidden fields in the form.

Surely there is a way… I am not familiar how or where I would inject that script or what to modify.

Thanks again for your kindness and responses.

Can you try using https://tally.so instead of just tally.so? I forgot to include the scheme, and without it, the URL resolves to https://test-profitable-questions.ghost.io/see-if-member-details-parse-on-in-a-tally-form/tally.so/embed/3ek1vx/

Thanks but it isn’t passing them member.name or member.email into hidden fields into tally at all. I don’t know what else to try.

Are you adding this via code injection or as part of your theme? If it’s done via code injection, you need to use the other method I shared. If you’re adding this via an html block in the editor, you have to use code injection.

Oh Apologies for not understanding. I tried the code injection in conjunction with the html and it did not result either.

If I added it to theme would I not have to download theme and upload everytime I added a form to the blog?

I don’t see the iframe or the injected code on https://test-profitable-questions.ghost.io/see-if-member-details-parse-on-in-a-tally-form/ - did you remove it? Make sure both parts exist!

If you created the URL via your theme, yes, every time you want to add a new form you would have to upload a new version of your theme. I would recommend code injection if you have multiple forms.

1 Like

I will have a fresh look at it today and see if I can make it work. Thank you for such a generous effort to help me.