how to give required fields missing based on the product type

  • 1
  • Question
  • Updated 3 years ago
  • Answered
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
Photo of raj

raj

  • 840 Points 500 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
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.
Photo of raj

raj

  • 840 Points 500 badge 2x thumb
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
(Edited)
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
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.
Photo of raj

raj

  • 840 Points 500 badge 2x thumb
for one button not possible.?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
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.
Photo of raj

raj

  • 840 Points 500 badge 2x thumb
Thanks Raymond, i am doing save actions in script, will try to implement your suggestions. 
(Edited)
Photo of raj

raj

  • 840 Points 500 badge 2x thumb
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.?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,552 Points 10k badge 2x thumb
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:
http://youtu.be/PvMuf6k7thU