Permission denied error ASP.Net Vsual studio

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Colin Graham

    #1

    Permission denied error ASP.Net Vsual studio

    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.F orm1.txtDate.va lue = '05/10/2004'

    The complete line of code is

    <script language="javas cript">window.o pener.Form1.txt Date.value =
    '05/10/2004';window.cl ose();
  • Grant Wagner

    #2
    Re: Permission denied error ASP.Net Vsual studio

    Colin Graham wrote:
    [color=blue]
    > 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.F orm1.txtDate.va lue = '05/10/2004'
    >
    > The complete line of code is
    >
    > <script language="javas cript">window.o pener.Form1.txt Date.value =
    > '05/10/2004';window.cl ose();[/color]

    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(fo rmName, elementName, value) {
    document.forms[formName].elements[elementName].value = value;
    }
    </script>

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

    --
    Grant Wagner <gwagner@agrico reunited.com>
    comp.lang.javas cript FAQ - http://jibbering.com/faq

    Comment

    • lawrence

      #3
      Re: Permission denied error ASP.Net Vsual studio

      Grant Wagner <gwagner@agrico reunited.com> wrote in message[color=blue]
      >
      > 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(fo rmName, elementName, value) {
      > document.forms[formName].elements[elementName].value = value;
      > }
      > </script>
      >
      > -- in the opened window --
      > <script type="text/javascript">
      > opener.setFormV alue('Form1', 'txtDate', '05/10/2004');
      > window.close();
      > </script>[/color]

      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?

      Comment

      • Colin Graham

        #4
        Re: Permission denied error ASP.Net Vsual studio

        > -- in the opened window --[color=blue]
        > <script type="text/javascript">
        > opener.setFormV alue('Form1', 'txtDate', '05/10/2004');
        > window.close();
        > </script>[/color]

        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_Selec tionChanged(sen der As Object, e As
        System.EventArg s)
        Dim strjscript as string '= "<script language=""java script"">"
        strjscript = strjscript & "window.opener. " &
        Httpcontext.Cur rent.Request.Qu erystring("form name") & ".value = '" &
        Calendar1.Selec tedDate & "';window.close ();"
        strjscript = strjscript & "</script" & ">" 'Don't Ask, Tool
        Bug
        Literal1.text = strjscript
        End Sub




        C

        Comment

        Working...