www.webdeveloper.com
Results 1 to 2 of 2

Thread: form name not found on asp.net page

  1. #1
    Join Date
    Jun 2012
    Posts
    58

    form name not found on asp.net page

    I have an asp.net page that I put some javascript on using the following code:

    Code:
            If (Not ClientScript.IsClientScriptBlockRegistered("clientScript")) Then
                ClientScript.RegisterClientScriptBlock(Me.GetType(), "clientscript", sScript)
            End If
    The code gets put inside the <form> tags but when I run the code I get an error that says that "formFloorPlan is undefined"

    Code:
              <form name="ctl00" method="POST" action="FloorMgr_Cleaned.aspx" id="ctl00">
    <div>
    Image goes here
    </div>
    
    <script language=javascript type="text/javascript"> 
    showStatus('Saving Locations...');
    //Update points for every floor object
    document.body.style.cursor = "wait";
    IDs = new Array();
    xLocations = new Array();
    yLocations = new Array();
                             
    for(x=0;x<document.all.length;x++)
    {
    test = new String(document.all(x).id);
    if(test.indexOf("FloorObject_") != -1)
    {
    //We must store only UNSCALED coordinates!  Meaning:  Divide by the scale factor before storing
    xpos = document.all(x).style.posLeft / formFloorPlan.scalefactor.value;      
    ypos = document.all(x).style.posTop / formFloorPlan.scalefactor.value;
    IDs[IDs.length] = test.substr(12);
    xLocations[xLocations.length] = xpos;
    yLocations[yLocations.length] = ypos;
    }
    }
    formFloorPlan.objectIDs.value = IDs.toString();
    formFloorPlan.objectXlocations.value = xLocations.toString();
    formFloorPlan.objectYlocations.value = yLocations.toString();
    /////////////////  LocationCodes (roomcodes) Handling ////////////
    Why is it not defined?

    Thanks.

  2. #2
    Join Date
    Jan 2011
    Location
    United Kingdom, London
    Posts
    117
    Code:
    formFloorPlan.objectIDs.value = IDs.toString();
    formFloorPlan.objectXlocations.value = xLocations.toString();
    formFloorPlan.objectYlocations.value = yLocations.toString();
    that's first time you call formFloorPlan and that's probably fire this error

    there is no formFloorPlan = 'something' so it's undefined

    secondly, you shouldn't keep js inside form
    Javascript, jQuery / Prototype & PHP expert ready to complete your work on Freelancer.co.uk - Hire Me at https://www.freelancer.co.uk/users/1...&action=hireme

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles