Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the error: JavaScript runtime error: Circular reference in value argument not supported

When trying to edit and save a record in an ajax call via javascript, I am getting the above subject error.

I did some looking up, and the only thing I can find was something about a "compareByIdentity" property which I couldn't get how to implement in my situation, if that's the case.

The below class is where there is a one to many relationship. There can be one "project" to many "timetrackings". This is the class for the "TimeTrackings" where the "ProjectID" is the foreign key.

I am using a WCF application to retrieve and edit the data with EF 6. This is the first time I'm encountering it in my application. Obviously, because of the way the relationship is set up.

Can someone please inform me how I can correct this error?

namespace YeagerTechDB.Models
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.Runtime.Serialization;

    [Serializable, DataContract(IsReference = true)]
    public partial class TimeTracking
    {
        [Key]
        [ScaffoldColumn(false)]
        [Editable(false)]
        [Display(Name = "Tracking ID")]
        [DataMember]
        public int TimeTrackingID { get; set; }

        [Required]
        [Display(Name = "Project ID")]
        [DataMember]
        public short ProjectID { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [DataMember]

        public DateTime StartDate { get; set; }

        [Required]
        [DataType(DataType.Date)]
        [DataMember]

        public DateTime EndDate { get; set; }

        [DataType(DataType.MultilineText)]
        [DataMember]
        public string Notes { get; set; }

        [DataType(DataType.DateTime)]
        [DataMember]
        public DateTime CreatedDate { get; set; }

        [DataType(DataType.DateTime)]
        [DataMember]
        public DateTime? UpdatedDate { get; set; }

        [DataMember]
        public virtual Project Project { get; set; }
    }
}

The output of the debugging is below. Please copy the image and paste it to your favorite image viewer for better detail.

Notice that the value of the TimeTrackingID is set correctly to 1. enter image description here

like image 607
sagesky36 Avatar asked Mar 18 '23 00:03

sagesky36


1 Answers

The problem is coming from your JSON.stringify in line 66.

You are converting the object Tracking_Input to json. Tracking_Input.TimeTrackingID is a jquery array of dom elements with the id TimeTrackingID, and this cannot be converted to json.

Did you mean $('TimeTrackingID').val() to match the other lines

like image 135
Chris Charles Avatar answered Apr 25 '23 11:04

Chris Charles