mrackley / StratusForms

Lightweight InfoPath alternative for SharePoint 2007,2010,2013,2016,2019 and Office 365
82 stars 36 forks source link

select stores label instead of value #52

Open plbowers opened 5 years ago

plbowers commented 5 years ago

So after wandering for a while I found #29 and looking at the change and revert there I finally figured out that I could "fix" this behavior by adding the class "SFUseLookupID".

However, that ONLY works if you are actually saving it to a field. Note this section of code:

        formVal = $(this).attr("listFieldName");
        if (formVal != undefined) {
            if($(this).hasClass("SFUseLookupID"))
            {
                StratusFormsValuePairs.push([$(this).attr("listFieldName"), $(this).val()]);
            }
            else
            {
                StratusFormsValuePairs.push([$(this).attr("listFieldName"), CDataWrap(value)]);
            }
        }

So if I don't have a listFieldName attribute (because I'm saving it in the StratusForms JSON column and that's all I need) then there's no way to save it as the value instead of the label.

(I assume this behavior (saving label instead of value) is helpful in some instances. It is very non-standard in terms of how HTML forms work in general...)

plbowers commented 4 years ago

So I noticed an official release recently and this didn't make it into the release as I had hoped. Do you have a preferred way to provide this type of report to make it easier for you and thus more likely to make it into an official release? I'm happy to provide a pull request or something if that would help.

mrackley commented 4 years ago

Sorry for missing this one. The reason I save the text instead of the value on selects is because of lookup fields and by storing the ID in the JSON object it was often harder to report on that data because of the extra hoops to jump through to get the value.. but yes, I understand it's non-standard... I will get a solution to your issue added in the current release that doesn't break existing forms out there that rely on the current way of handling it. Feel free to berate me if this takes more than a few days.

mrackley commented 4 years ago

adding this uncovered a couple of other bugs that were in 1.55... makes me a bit nervous about the release but got those fixed and added the check of a class "SFStoreValue" on a select to store the value in the JSON Object. If you don't mind, please give it a try and report back?