By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,882 Members | 2,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,882 IT Pros & Developers. It's quick & easy.

Permission denied error ASP.Net Vsual studio

P: n/a
I am working with a piece of javascript that i have inherited from
another developer. It is for a date picker function and it runs fine
locally but i get an error when i deploy it on the server and run it.
Can anyone help me with my issue i get a permission denied error also
when the error begins.
i get the error on the folowing part of the codee:

window.opener.Form1.txtDate.value = '05/10/2004'

The complete line of code is

<script language="javascript">window.opener.Form1.txtDate. value =
'05/10/2004';window.close();
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Colin Graham wrote:
I am working with a piece of javascript that i have inherited from
another developer. It is for a date picker function and it runs fine
locally but i get an error when i deploy it on the server and run it.
Can anyone help me with my issue i get a permission denied error also
when the error begins.
i get the error on the folowing part of the codee:

window.opener.Form1.txtDate.value = '05/10/2004'

The complete line of code is

<script language="javascript">window.opener.Form1.txtDate. value =
'05/10/2004';window.close();


You can't set the value of a form element in another window. The solution
to this is to create a function in the opener that does the setting, then
invoke that from the opened window:

-- in the opener --

<script type="text/javascript">
function setFormValue(formName, elementName, value) {
document.forms[formName].elements[elementName].value = value;
}
</script>

-- in the opened window --
<script type="text/javascript">
opener.setFormValue('Form1', 'txtDate', '05/10/2004');
window.close();
</script>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #2

P: n/a
Grant Wagner <gw*****@agricoreunited.com> wrote in message

You can't set the value of a form element in another window. The solution
to this is to create a function in the opener that does the setting, then
invoke that from the opened window:

-- in the opener --

<script type="text/javascript">
function setFormValue(formName, elementName, value) {
document.forms[formName].elements[elementName].value = value;
}
</script>

-- in the opened window --
<script type="text/javascript">
opener.setFormValue('Form1', 'txtDate', '05/10/2004');
window.close();
</script>


Forgive the ignorant question, but in this last script, I see you use
opener as some kind of global. Is it built into the DOM? One can use
it in a script and assume it always exists?
Jul 23 '05 #3

P: n/a
> -- in the opened window --
<script type="text/javascript">
opener.setFormValue('Form1', 'txtDate', '05/10/2004');
window.close();
</script>


in the code above i need to change the '05/10/2004' part to a value of
a variable pulled in from the calendar form. how can i do this as the
value is pulled in in the folowing code in a sub.

Private Sub Calendar1_SelectionChanged(sender As Object, e As
System.EventArgs)
Dim strjscript as string '= "<script language=""javascript"">"
strjscript = strjscript & "window.opener." &
Httpcontext.Current.Request.Querystring("formname" ) & ".value = '" &
Calendar1.SelectedDate & "';window.close();"
strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool
Bug
Literal1.text = strjscript
End Sub


C
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.