Remove Required from fields with button

I would like to add a “Developer Mode” button that removes the “Required” validation from fields so I can test it without having to enter data in all the fields. 

What would be the easiest way to do this? I was looking at appending to the XML document, but I’m not sure how I would do this?

Appreciate any help you can give.

Thank you

You could clone the components, then set a render condition so that only developers see the different components where the “Required” sections are chosen. Then you could put a render condition on everything else that hides it for developers. 

Thank you for the reply Stephen! However, I would like to find a way to not have to clone everything in on the page since there is a lot of other conditional rendering and custom code that runs on different elements along with all the changes I’m going to make.

I tried just running a script that removes the “required” class from different elements, but that doesn’t do the trick.

I’m guessing I would need some code to remove the “required” attribute from the XML elements and then re-render the page. But, I’m not sure what that code would look like. 

Does anyone have an example of how to remove an xml attribute with a script and then re-render the page?

I may not have all the pieces to how to do this yet, so please correct me if I’m wrong.

Thank you,


Are the fields required at the database level, or just required at the ui level? You could use a script to remove the XML “required” attribute and re-render the Field Editor, but… would rather not encourage that sort of hackiness :slight_smile:

here’s another idea — could you pre-populate dummy values for all the required fields via a Model Action? You could conditionally provide dummy values for the fields based on the Profile / Usernames / User Ids of the user viewing the page. If you add a Model Action to the Model(s) that need sample fields, you could add have the Initiating Event be “Row created”, and then have a “Branch” Action that checks to see if the running user’s profile name is some value, or if the User Id is one of a set of values, and, if so, then run some “Update Row” Actions to pre-populate dummy values.

Or alternatively there could be a conditionally-rendered button on the page that says “Populate dummy data”, and you could only render this button based on the user id / profile id, and have this button pre-populate dummy values.

Great Idea Zach! Half of me just wanted to learn how to do this via XML, but the alternative idea is much better. I’ll just add a developer mode UI-Only field on the UI Model and then branch action on the buttons that create rows to populate the data if checked to where I don’t have to enter it every time I run through the app. Then only show the developer mode button on my profile that way it won’t show on the public profile.

Thank you!