Page 1 of 1

Required Field based on user Selection

Posted: 26 Feb 2015
by coresoul
i have a checkbox filed called travelRequired (Yes/No) and a number field called TravelPercentage. Initially i want to hide TravelPercentage. If user selects travelRequired as Yes, i want to show TravelPercentage and make this field required. if user unselect the checkbox, it should clear the TravelPercentage field and hide that field.

Re: Required Field based on user Selection

Posted: 27 Feb 2015
by Dmitry Kozlov
Hi,

You can find examples of making fields mandatory or hiding fields based on other field values in the following post:

http://spform.com/office-365/cond ... ynamically

Re: Required Field based on user Selection

Posted: 04 Mar 2015
by coresoul
Here, checktype is a dropdown field. everything works except clearing the AFH_x0020_Replacement_x0020_Reas field when value in dropdown changed. Am i doing something wrong.

function checktype(){

if(fd.field('AFH_x0020_Type').value()=='Replacement'){

$('.replacementreason').show();

}

else{

fd.field('AFH_x0020_Replacement_x0020_Reas').value('');

$('.replacementreason').hide();

}

}

fd.field('AFH_x0020_Type').change(checktype);


checktype();

Re: Required Field based on user Selection

Posted: 04 Mar 2015
by coresoul
sorry AFH type is a dropdown field

Re: Required Field based on user Selection

Posted: 05 Mar 2015
by Dmitry Kozlov
This code works well for me:

Code: Select all

fd.field('AFH_x0020_Replacement_x0020_Reas').value('');
Please, make sure that you use the correct internal name of the field and that the field type is Choice (DropDown).

Re: Required Field based on user Selection

Posted: 06 Mar 2015
by coresoul
Hi it didn't work for me. i forgot to mention that the field that i am trying to clear is a multiple line textbox, if that makes difference

Re: Required Field based on user Selection

Posted: 09 Mar 2015
by Dmitry Kozlov
What type of the multiline text field do you use: Plain text, Rich text, or Enhanced rich text?

Re: Required Field based on user Selection

Posted: 11 Mar 2015
by coresoul
i have all three types in the form (Plain text, Rich text, or Enhanced rich text)

Re: Required Field based on user Selection

Posted: 13 Mar 2015
by coresoul
i need your help please

Re: Required Field based on user Selection

Posted: 14 Mar 2015
by Dmitry Kozlov
Hi,

You can find samples of getting/setting fields of different types in our blog:

http://spform.com/forms-designer- ... eld-values