Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

feat: add conditional required, fix formatting in document.js, fix async calls for submit and revert. #152

Merged
merged 5 commits into from
Nov 8, 2021

Conversation

18alantom
Copy link
Member

@18alantom 18alantom commented Nov 5, 2021

  • Added conditional required, required can be a function that receives a subset of doc.
  • The subset here consists only of fieldname and fieldvalues.
  • Doc itself is not passed so as to prevent side effects.

Required can now be set like so.

fields: [
    {
      fieldname: 'paymentMethod',
      label: 'Payment Method',
      fieldtype: 'Select',
      options: ['', 'Cash', 'Cheque', 'Transfer'],
      required: 1
    },
    {
      fieldname: 'referenceId',
      label: 'Ref. / Cheque No.',
      fieldtype: 'Data',
      required: (doc) => doc.paymentMethod !== 'Cash'
    },
]

@18alantom 18alantom force-pushed the add-conditional-require branch from 0ae6b23 to b515e2f Compare November 5, 2021 12:00
@18alantom 18alantom changed the title feat: add conditional required, fix formatting in document.js feat: add conditional required, fix formatting in document.js, fix async calls for submit and revert. Nov 8, 2021
@18alantom 18alantom merged commit b791f1a into frappe:master Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant