ASP.NET names forms inside user controls with an invalid name causing script error

Discussion in 'ASP .Net Web Controls' started by William D. Sossamon, May 4, 2004.

  1. http://support.microsoft.com/default.aspx?kbid=818803

    1.. You add the following form to a user control:
    <form id="Form1" name="Form1" runat="server">2.. You add the user control,
    for example, Workspace1, to a page. When you do this, an auto-generated
    script that is similar to the following script is added to the page:
    <form name="Workspace1:Form1" method="post" action="formtest2.aspx"
    id="Workspace1_Form1">The script error occurs because the form name and the
    form ID are different, and the form name contains a colon as a delimiter.

    Another example of the problem in the automatically generated script for a
    __doPostBack function is the following:
    function __doPostBack(eventTarget, eventArgument)
    {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
    {
    theform = document.forms["_ctl14:Form1"];
    }
    else
    {
    theform = document._ctl14:Form1;
    }

    theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
    theform.__EVENTARGUMENT.value = eventArgument;
    theform.submit();
    }
    Notice that the form has a uniqueID property that contains a colon in the
    following lines:
    theform = document.forms["_ctl14:Form1"];
    theform = document._ctl14:Form1;
    I cannot find a patch or work around for this issue other than contacting
    PSS, can anyone help me with this? Any additional information would be
    greatly appreciated.William D. SossamonMCP,
     
    William D. Sossamon, May 4, 2004
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William D. Sossamon
    Replies:
    0
    Views:
    504
    William D. Sossamon
    May 4, 2004
  2. jb
    Replies:
    3
    Views:
    2,306
    =?Utf-8?B?U3VicmFtYW5pYW4gQVBM?=
    Aug 24, 2006
  3. Bob Rock
    Replies:
    1
    Views:
    911
    Cowboy \(Gregory A. Beamer\)
    Sep 17, 2006
  4. Andy B
    Replies:
    3
    Views:
    467
    Andy B
    Jun 9, 2008
  5. Chris Lane
    Replies:
    1
    Views:
    235
    Hermit Dave
    Nov 25, 2003
  6. Roman
    Replies:
    2
    Views:
    455
    Roman
    Jan 4, 2005
  7. Kiran More
    Replies:
    2
    Views:
    527
    Kiran More
    Nov 14, 2006
  8. J M
    Replies:
    2
    Views:
    205
    Tad McClellan
    Nov 6, 2004
Loading...