Required Fields for every Department

rss

Posted by TWendt - Sep 28 ’16 at 03:16

Hi all,

i have six departments. For every department i have a choice field Approved / Not approved, a date field and a people picker field. If the choice field is marked, the other fields should be required. What must i do?

Best wishes

Tom

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 9 months 26 days
    #1 by Dmitry Kozlov Sep 28 ’16 at 05:09
  • TWendt
    Member
    Member for: 4 years 10 months 8 days
    #2 by TWendt Sep 30 ’16 at 02:05

    Hi Dmitry,

    thanks for the information. But can you give me more information about a choice field with radio buttons 'PME_x002d_Freigabe'?

    function setRequiredFields() { if (fd.field('PME_x002d_Freigabe').value().dictionaryEntries.length != 0) { // Add asterisks fd.field('PME_x002d_Datum').titleRequired(true); } else { // Remove asterisks fd.field('PME_x002d_Datum').titleRequired(false); } } Unfortunately it does not work. Best regards Tom
  • YuriyMedvedev
    Moderator
    Member for: 2 years 9 months 21 days
    #3 by YuriyMedvedev Oct 2 ’16 at 03:06

    [#2]: Hi!

    For radio-buttons you have to use just "value()", like in this example. Here, if first radio is choosen "Name"-field is not required, but if you chose other radio - it is required.

     

    function setRequiredFields() {

    if (fd.field('Radio').value() != 0) {

    fd.field('Name').titleRequired(true); }

    else {

    fd.field('Name').titleRequired(false); } }

    fd.field('Radio').change(function(){

    setRequiredFields();

    });

    setRequiredFields();

Displaying 1 to 3 of 3 messages