"If hidden, Model field changes should be cancelled" not working on new record

I replied here, but just noticed that post is marked solved and I am still having the issue on version 11.1.6. I created a simple test page (XML below) to show this using a model based on the Account object that creates a new record. When Type=Other, the Description field shows; otherwise it’s hidden. However, if the user types a value into Description, then selects a Type besides Other, whatever was entered into Description is retained in the model (see below image). This is a contrived example, but there are many cases when a user changes an entry before saving that invalidates the values of conditionally hidden fields, so those fields should revert to null (or whatever their initial value was when the new record/row was added, e.g., default values).

Cancel-changes-if-hidden does work on existing database records from what I can tell; my issue only applies to new/unsaved records.

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="testAccount" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Account">
            <fields>
                <field id="Type"/>
                <field id="Description"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="testAccount" uniqueid="sk-mBb-305" mode="edit">
            <columns>
                <column width="100%">
                    <sections>
                        <section title="Section A" collapsible="no" showheader="false">
                            <fields>
                                <field uniqueid="sk-mBb-358" id="Type"/>
                                <field uniqueid="sk-mBb-359" id="Description">
                                    <renderconditions logictype="and" onhidedatabehavior="cancel">
                                        <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="true" fieldmodel="testAccount" sourcetype="fieldvalue" field="Type" fieldtargetobjects="Account" value="Other"/>
                                    </renderconditions>
                                    <enableconditions/>
                                </field>
                            </fields>
                        </section>
                    </sections>
                </column>
            </columns>
        </basicfieldeditor>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-2CZNLe-315"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

Thank you for bringing this to our attention. I have been able to reproduce what you are seeing. I’ve logged this as an issue and our development team is taking a look at it now. I’ll respond back when a fix or workaround is provided. 

Hello,

I am also having this issue. Could you please give an ETA as this functionality is very crucial for my page.

Thanks,
Richa Sharma

Could you provide any further clarity as to what exactly you’re trying to do? The more background in how your using the page and what exactly your need is, the better speed the ETA will have.

Hello Stephen,

Actually, I have created an edit page using conditional rendering. I have fields (which includes textbox, picklist etc.) which are rendered when there is a particular value selected on the first two picklists… Rendering is working fine… I have selected “If hidden, Model field changes should be canceled”… 


If the field is not rendered it should not save the value of that field even if it has value.

But its still saving it and it has defeated the actual purpose of rendering.

Could you please guide me if I am missing anything and let me know if some tweak is required from your side.

You aren’t missing anything. We’re working on creating a fix as soon as possible.

I should clarify, if you could provide more insight into how you’re wanting to use that functionality specifically and why, that could potentially create a higher priority I can take to my team to explain why it should be prioritized over other known issues.

Hello Stephen,

As I have created a page where one object record should be inserted. The page has several fields but all fields should not be displayed to the user. The rendering of fields depends on the value from the two picklists If I have selected Option 1 in the first picklist and option 3 in the second one…I should show location text field to user…This is working well…I can save this and it gets saved.

Same case is for edit as well…

Let’s say for example I edit this record which I just created… And I select Option 1 in the first picklist and option 2 in the second picklist, now location text box is hidden and duration picklist is rendered true… If I enter a value in the duration field… it should clear the location text box value when saved…

Hope I have cleared my query.


Thanks,
Richa Sharma

Just wondering, did this ever get fixed? I am seeing something similar that I am currently working on.

Thanks!

My above question can be disregarded!

I think I was misreading my own results, thinking that “cancel changes” would make the hidden component revert to the default value. It does go to the last saved value, which seems to be expected functionality.

Thanks