SOLVED

Setting the value of an input in the parent window (the LP Editor) using JS on the page itself

Go to solution
Dave_Roberts
Level 10

Re: Javascript - Using Custom Namespace in Landing Page Editor

Another approach that maybe more stable might be to provide the user with a dialog box to copy/paste the value into the variable rather than trying to set it automatically.

 

You could add a script to the template that only fired in the Editor Experience and surfaced the values you're looking for a user to add into the variable.

It might go something like:
// IF: this page is NOT inside the Marketo Editor experience (check the path for some part of the URL that doesn't exist in the approved LP) == do nothing

// ELSE: surface the values you're looking for inside of one iFrame and pass them to a dialog box that pops up to the end user for a copy/paste into the Variable panel. Maybe include some instructions in the dialog to make it easy-bake.

 

You might also include this as a button to optimize the UI a bit. The button might trigger a modal in the Editor iFrame (left side of the editor experience) so that a user could click the button to trigger the pop up when/if they need that info.

 

Thorsten
Level 4

Re: Javascript - Using Custom Namespace in Landing Page Editor

Thanks Dave for sharing your experiences and providing so much food for thought! Much appreciated.

 

I need to breed over this for a while. At the moment I am hesitant to make any change in either direction, thinking that the user experience with a modal or stability issues down the road will be severely impacted. I'm leaning towards leaving it with a more fancy default value for now and otherwise waiting to see if more users flag this as an inconvenience worth fixing.

 

Anyway - thank you all again for the inputs!

SanfordWhiteman
Level 10 - Community Moderator

Re: Javascript - Using Custom Namespace in Landing Page Editor

DM’d you the code in any case (not suitable for general use!).