Hello -
I am hoping a kind Javascript expert can solve this little problem for me, as I do not really know JS (and I know there are some very clever people who hang out here, who are very helpful, so I thank you in advance):-
On one of my Actinic template pages I have created an IFrame, that calls in a separate HTML page. The content of the IFrame is actually a little sign-up/survey form that the customer can fill in and Submit there and then, without being taken off the Actinic page in the store. This all works fine.
However, what I would like to add to the form is a text input field that is automatically filled in with the title of the page the customer currently on, which will actually be the Actinic variable 'Product name'. This is what I am having a little trouble achieving.
So, in my Actinic template for this page, between the <body></body> tags, I have the following code:-
Then, inside the form on the separate HTML page being called into this IFrame, I have the following input box:-
However, when the user clicks the 'Submit' button for this form inside the IFrame, although I get all the information the user has entered into the other boxes in this form, the value for the 'productname' input box comes back as "startValue" and not "thisWorks" (which I will change to the appropriate Actinic variable when I get it working at this level).
So the Javascript code as I have it at the moment as shown above does not seem to be having any effect in setting the value of the 'productname' text input box in the HTML page being called into the iFrame. I am not getting any 'errors', just not the effect required.
Can anybody see where I am going wrong on this?
Thanks again
I am hoping a kind Javascript expert can solve this little problem for me, as I do not really know JS (and I know there are some very clever people who hang out here, who are very helpful, so I thank you in advance):-
On one of my Actinic template pages I have created an IFrame, that calls in a separate HTML page. The content of the IFrame is actually a little sign-up/survey form that the customer can fill in and Submit there and then, without being taken off the Actinic page in the store. This all works fine.
However, what I would like to add to the form is a text input field that is automatically filled in with the title of the page the customer currently on, which will actually be the Actinic variable 'Product name'. This is what I am having a little trouble achieving.
So, in my Actinic template for this page, between the <body></body> tags, I have the following code:-
Code:
<IFRAME id="I1" name="I1" src="http://www.....(HTML page I'm calling into the IFrame)....page.html" frameBorder=0 width=500 height=200></IFRAME> <script language="javascript" type="text/javascript"> window.onload = function() { var eyeframe; eyeframe = document.getElementById('I1'); var eyeframedoc; eyeframedoc = eyeframe.contentWindow ? eyeframe.contentWindow.document: eyeframe.contentDocument; eyeframedoc.getElementbyId('productname').value="thisWorks"; } </script>
Then, inside the form on the separate HTML page being called into this IFrame, I have the following input box:-
HTML Code:
<input type="text" id="productname" name="productname" value="startValue">
So the Javascript code as I have it at the moment as shown above does not seem to be having any effect in setting the value of the 'productname' text input box in the HTML page being called into the iFrame. I am not getting any 'errors', just not the effect required.
Can anybody see where I am going wrong on this?
Thanks again
Comment