locked
After customizing newform.aspx, submit form and editpage throws correlation id error RRS feed

  • Question

  • Hi,

       I am customizing the newform.aspx where name field displays the logged in users name, and city dropdown is populated  from list B based on username,  based on selection of city from dropdown the values for text fields like street,zip should be autopoulated(from list B), I am able to achieve this using the Jquery and SpServices in content editor webpart. But the issue here is though the dropdown and text box are populated, It gives a correlation id error on submitting the form and editing the page.

    Here's the script I added:

    <script src="/SiteAssets/jquery-1.7.2.js" type="text/javascript"></script><script src="/SiteAssets/jquery.SPServices-0.7.1a.js" type="text/javascript"></script><script type="text/javascript">


    $(document).ready(function() {

    var empName=$("input[title='PartnerName']").val();

     $("select[title='AddressNick']").empty();
     
      $("select[title='AddressNick']").append($("<option></option>").attr("value","Select Address").text("Select Address"));  

    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "NewShippingAddress",
    CAMLViewFields: "<ViewFields><FieldRef Name='AddressNick' /></ViewFields>",
         CAMLQuery: "<Query><Where><Eq><FieldRef Name='PartnerName'/><Value Type='Text'>" + empName + "</Value></Eq></Where></Query>",
     completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function() {
      $("select[title='AddressNick']").append($("<option></option>").attr("value",$(this).attr("ows_AddressNick")).text($(this).attr("ows_AddressNick") ));  
      });
    }

         });


    $("select").change(function() {
    var selectedValue = this.value;
    if(selectedValue=="Select Address")
    {
    $("input[title='City']").val("");
     $("input[title='State']").val("");
    $("input[title='Zip']").val("");
    $("input[title='Attn']").val("");
    $("input[title='ContactNumber']").val("");
    alert("Please Select Address Nick");
    }
    else
    {
    $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "NewShippingAddress",
        CAMLViewFields: "<ViewFields><FieldRef Name='City' /><FieldRef Name='State' /><FieldRef Name='Zip' /><FieldRef Name='Attn' /><FieldRef Name='ContactNumber' /></ViewFields>",
           CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='AddressNick'/><Value Type='Text'>" + selectedValue + "</Value></Eq><Eq><FieldRef Name='PartnerName'/><Value Type='Text'>" + empName + "</Value></Eq></And></Where></Query>",
     completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function() {
     $("input[title='City']").val($(this).attr("ows_City"));
     $("input[title='State']").val($(this).attr("ows_State"));
    $("input[title='Zip']").val($(this).attr("ows_Zip"));
    $("input[title='Attn']").val($(this).attr("ows_Attn"));
    $("input[title='ContactNumber']").val($(this).attr("ows_ContactNumber"));

       
      });
    }

         });
    }

    });

    });

    </script>

    Thanks,

    Poonam

    Wednesday, March 27, 2013 5:55 AM

All replies

  • Hi Poonam,

    Go check in your ULS logs, search for the correlation ID you received on the error screen and post the error details here, this will give the actual error.

    The ULS log is located here "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Logs"

    Regards
    Pieter
    Wednesday, March 27, 2013 9:18 AM
  • Hi,

    Here's the log

    03/28/2013 06:21:36.70 w3wp.exe (0x21A8)                       0x23F4  SharePoint Foundation                 Monitoring                         b4ly                High       Leaving Monitored Scope (PostResolveRequestCacheHandler). Execution Time=267.388732366823                4e1444bc-5c91-47b0-9bf3-6035816d0de1

    03/28/2013 06:21:36.77 w3wp.exe (0x21A8)                       0x23F4  SharePoint Foundation                 Runtime                               tkau                Unexpected       System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.    at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)     at System.Web.UI.WebControls.DropDownList.LoadPostData(String postDataKey, NameValueCollection postCollection)     at System.Web.UI.Page.ProcessPostData(NameValueCollection pos...       4e1444bc-5c91-47b0-9bf3-6035816d0de1

    03/28/2013 06:21:36.77*               w3wp.exe (0x21A8)                       0x23F4  SharePoint Foundation                 Runtime                                       tkau       Unexpected       ...tData, Boolean fBeforeLoad)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)            4e1444bc-5c91-47b0-9bf3-6035816d0de1



    Thanks,

    Poonam

    Thursday, March 28, 2013 12:59 PM
  • When I added EnableEventvalidation=false to newform.aspx page through SPD, I get an error message

    "The enableeventvalidation attribute on the page directive is not allowed in this page." Any suggestion how to rectify this

    Friday, March 29, 2013 8:21 AM
  • hi, this is a valid exception  as you had modified the content of server control on the client side that will break the control tree managed by the ASP.NET architecture where it maps the data from the view state. so if you want to perform such operations on client side you have to use base <Select> tag without runat ="server" attribute and on from submission get the data from it by finding control on the page or use hidden fields.
    Friday, March 29, 2013 11:55 AM
  • Thanks Ishaan,

        But I am really not very sure how to achieve this, since I am new to sharepoint.

    Thanks,

    Poonam

    Friday, March 29, 2013 12:25 PM