Passing metadata value to hidden field


(Stephen Wardle) #1

I'm stuck again, whaaaa…


I'm really really struggling to pass the value from my metadata to a hidden field in a form.



I want to nest a form on a few different pages. I have a field in the form that I want to record a string from the metadata of each of the pages. When I write the keyword (%asset_metadata_VWA.attachment%) for the metadata directly to the page, it outputs the string no problem. But when I wrap it in the form field (<input type="hidden" name="q43959:q1" value="%asset_metadata_VWA.attachment%" size="30" maxlength="300" id="q43959_q1"/>) I get nothing. I've tried even passing it using inner HTML, I've tried setting it as the default value, but I can't seem to get a very simple thing such as this to work. Any ideas?



Cheers guys


(Mpettitt) #2

You're trying to pick up the metadata of the form, whereas you probably want the metadata of whatever the form is embedded in. Does %globals_asset_metadata_VWA.attachment% do anything more useful?


(Nic Hubbard) #3

Also, be careful about nesting Custom Forms because caching can prevent the form from even working.


(Stephen Wardle) #4

Yeah that's what I'm doing, nesting the form. I need the form to pop into a modal window on the host page. So I'm trying to load the metadata from the host page. The form is a registration for a survey we want to do, so I need to capture a particular matadata field. I could just load a pop-up window on click and pass the metadata using javascript, but aren't pop-ups frowned upon in place of modals these days?


(Nic Hubbard) #5

[quote]
I could just load a pop-up window on click and pass the metadata using javascript, but aren't pop-ups frowned upon in place of modals these days?

[/quote]



Yes they are. Most users block popups now days.


(Stephen Wardle) #6

Mathew, thanks for your response, that seemed to fix the issue of populating the form field. Cheers heaps