Jump to content

Having a problem setting a "getElementById" on a frame..?


A JM
Go to solution Solved by A JM,

Recommended Posts

I'd like to set the value of a hidden object on an iFrame and I'm having a problem... what should be working isn't anyone have any ideas?

 

I set a default value initially but then need to update that value if a file is iedntified, if se then it should update the hidden field on the iFrame.

 

Thatnks for looking.

 

AJM,

<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
<input type="input" id="filename" name="filename" value="Q">								<!-- set default hidden variable to represent no file selected-->
{% for (var i=0, file; file=o.files[i]; i++) { %}
	{% if (file.url.split("/")[7] == '<?php echo session_id()?>') { %}						<!-- Skip over files not associated with the session_id() -->
		{% document.getElementById("filename").value="test"; %}								<!-- set hidden variable to file name if it exists  -->
		<tr class="template-download fade">
			<td>
				<span class="preview">
					{% if (file.thumbnailUrl) { %}
						<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
					{% } %}
				</span>
			</td>
			<td>
				<p class="name">
					<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
				</p>
				{% if (file.error) { %}
					<div><span class="error">Error</span> {%=file.error%}</div>
				{% } %}
			</td>
			<td>
				<span class="size">{%=o.formatFileSize(file.size)%}</span>
			</td>
			<td>
				<button class="delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>Delete</button>
				<input type="checkbox" name="delete" value="1" class="toggle">
			</td>
		</tr>
	{% } %}
{% } %}
</script>
Link to comment
Share on other sites

This code is running on the iFrame itself..  should it be implemented differently?

 

I'm a little confused on the iFrame implementation of "document" seems to me if its running on the iFrame it would be the "document" or that specific to the parent?

 

AJM,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.