Set field requirement conditionally

  • chuckiecc
    Asked on November 21, 2020 at 3:50 PM
    in my form we have two fields to capture the serial number off a specimen. Either a) with the barcode widget or b) manually if the barcode fails. I have currently set the barcode widget first in the work flow and IF the barcode has a value it hides the manual entry.. One problem is that either of these MUST be included in my form as required, However if the barcode fails (for whatever reason- perhaps see above) how can i code my form so that you go from the barcode widget to the manual entry serial number widget. I.e. if the bar code fails as it is required now, it wont let me proceed on the form. I NEED this serial number to be required for sure, but if the bar code fails, i need to be able to enter the serial number with the other widget, However MAKE SURE i have a value in one of the two fields. I don't need both.. How do I configure my widgets to match with workflow please. thanks
  • Bojan Support Team Lead
    Replied on November 21, 2020 at 4:02 PM

    This can be achieved using conditional logic.

    You can make a Barcode scanner unrequired and then add the conditional logic to the text field for manual entry. You need Enable/Require field condition:

    enable requiere fields Screenshot 10

    In it, you need to check if the Barcode scanner is filled, and then unrequire the manual entry:

    screenshot 2895 Screenshot 21

    You can also use the Show/Hide field condition to completely hide the field if the widget is filled:

    show hide fields Screenshot 32

    Let us know if this solution works for you.