ClevrSolutions / EnumToggle

Enumeration toggle widget for Mendix
1 stars 2 forks source link

The value undefined is not valid for this enumeration #9

Open potj99 opened 6 years ago

potj99 commented 6 years ago

Hi,

Let me start with saying I like this widget. I am using it in our project now and I get the attached error.

the value undefined is not valid for this enumeration error

I have an enumeration with the values Yes and No. When I click the widget, it shows very short "The value undefined is not valid for this enumeration error". It is displayed short and disappears automatically but is causing a lot of questions.

Could you please fix this?

Kind regards,

Jeroen

ChrisdeG commented 6 years ago

The keyvalues must be equal to the key values of the enumeration. They are case sensitive. If your enum is defined key=J caption=JA key=N caption=Nee you should use J in the keys of enumtoggle

potj99 commented 6 years ago

Hi Chris,

Thank you for replying so quick. They are the same

[cid:367b3b5c-085b-4939-b615-31ce3d6948f9]

[cid:a14f59f3-1278-48f1-bfda-4ea8fbbe6ac6]

Do you have any other suggestions?

Kind regards, Jeroen Pot


From: ChrisdeG notifications@github.com Sent: 11 July 2018 09:48:12 To: ChrisdeG/EnumToggle Cc: Jeroen Pot; Author Subject: Re: [ChrisdeG/EnumToggle] The value undefined is not valid for this enumeration (#9)

The keyvalues must be equal to the key values of the enumeration. They are case sensitive.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ChrisdeG/EnumToggle/issues/9#issuecomment-404077232, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALa3JOUcej2_zq7Kgxn3AjaD7oT8bKzdks5uFa28gaJpZM4VJMZT.

keving119 commented 4 years ago

I have the same error.

I seems that the widget does not evaluate the initial value correctly in my case. I have an enumeration which has the value FALSE, but when I load the widget, the image of the default value is shown. Which would only happen if the value was empty if I understand correctly?

ChrisdeG commented 4 years ago

Hi

Do you use Mendix 8, Would you test the new Mendix 8 version?

Kind regards,

Chris

Van: keving119 notifications@github.com Verzonden: Wednesday, May 6, 2020 11:08 PM Aan: ChrisdeG/EnumToggle EnumToggle@noreply.github.com CC: ChrisdeG cdgelder@flowfabric.com; Comment < comment@noreply.github.com> Onderwerp: Re: [ChrisdeG/EnumToggle] The value undefined is not valid for this enumeration (#9)

I have the same error.

I seems that the widget does not evaluate the initial value correctly in my case. I have an enumeration which has the value FALSE, but when I load the widget, the image of the default value is shown. Which would only happen if the value was empty if I understand correctly?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ChrisdeG/EnumToggle/issues/9#issuecomment-624891782, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR2BFEZGUSQHU3OB54R2H3RQHGSZANCNFSM4FJEYZJQ .

keving119 commented 4 years ago

I am currently using Mendix 8.6

keving119 commented 4 years ago

Currently using 8.11, but still experiencing the same error.

"I seems that the widget does not evaluate the initial value correctly in my case. I have an enumeration which has the value FALSE, but when I load the widget, the image of the default value is shown. Which would only happen if the value was empty if I understand correctly?"

keving119 commented 4 years ago

I think I fixed this; to resolve the error, I changed this._contextObj.get[this.name]); to this._contextObj.get(this.name]); However, the widget still was not loading the initial value, but just the fallback image. This was resolved by adding

                this.startValue = obj.get(this.name);
                this._setValueAttr(this.startValue);

to the update, so it becomes:

        update : function (obj, callback) {
            var i;
            if (obj) {
                this._contextObj = obj;
                this.contextGUID = obj.getGuid();
                this._resetSubscriptions();
                for (i = 0; i < this.notused.length; i+=1) {
                    this.checkEnumValue(this.notused[i].captions);
                }
                this.startValue = obj.get(this.name);
                this._setValueAttr(this.startValue);
            }
            if (callback) {
                callback();
            }
        },

Not sure if its a good code, because i never worked with javascript, but it works!