how to give required fields missing based on the product type

i have one look field “loan Product”. two loan products i have like 1. secured loan 2.Unsecured loan.
when i select 1.Secured loan from lookup field, Collateral model section will come automatically populate. for unsecured no collaterals.

for secured loan, when i click on save button( in actions, selecting the collateral for model saved changes) without enter any values ,its Showing error message like Collateral field required(whatever field made it as required in that model). its working fine

for unsecured, when i click on save button( in actions, selecting the collateral for model saved changes) without enter any values, its showing error message Collateral field required,even unsecured doesn’t contain any collateral model. how to make changes for unsecured loan in button actions

Did you try to conditionally render the collateral fields only when the loan product field equals secured. If the required fields aren’t rendered, you should be able to save without the error message.

i given the conditional rendering, thats working fine for secured loan. for unsecure basically collateral is not there. so if i clicking on save button after giving all details, it showing a message please enter valid collateral even for unsecured having no collateral. this issue getting cause of in my save button, i am adding the Action
 model saved = collateral.
This button action working for both secure and unsecure types. how to resolve this issue. i need error message for only secure type not for unsecure

You can create two save buttons. Buttons can be conditionally rendered as well. Render one button if product is secured and the other button if the product is unsecured. Don’t have the unsecured button save the collateral model.

for one button not possible.?

Not sure what your question is, but you can create two buttons and label them the same. You can set the rendering so that only one of the two display at any one time. The end user won’t even know there are two buttons. As far as doing it with one button, you would probably have to write a Java snippet to pull this off but I’m not a coder so someone smarter than I would have to help you with that.

Thanks Raymond, i am doing save actions in script, will try to implement your suggestions. 

i created two buttons for secure and unsecure type with rendering conditions, but those two buttons are not displaying in my application page

i given condition like

in my button –> Rendering tab –> condition like : model.field name=‘Unsecured Loan’

buttons are not displaying.

is there any way to display the buttons.?

Are you using Skuid’s conditional rendering settings on the button? It looks like you are writing the condition yourself instead… . Maybe this tutorial would help: - YouTube