Required Field based on user Selection
Posted by coresoul - Feb 26 ’15 at 12:56
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.
-
Dmitry KozlovAdminMember for: 9 years 8 months 7 days
Hi,
You can find examples of making fields mandatory or hiding fields based on other field values in the following post:
http://formsdesigner.blogspot.com/2014/07/how-to-conditionally-hide-disable-make.html
-
coresoulMemberMember for: 8 years 3 months 3 days
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();
-
coresoulMemberMember for: 8 years 3 months 3 days
[#2]: sorry AFH type is a dropdown field
-
Dmitry KozlovAdminMember for: 9 years 8 months 7 days
[#3]: This code works well for me:
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).
-
coresoulMemberMember for: 8 years 3 months 3 days
[#4]: 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
-
Dmitry KozlovAdminMember for: 9 years 8 months 7 days
[#5]: What type of the multiline text field do you use: Plain text, Rich text, or Enhanced rich text?
-
coresoulMemberMember for: 8 years 3 months 3 days
[#6]: i have all three types in the form (Plain text, Rich text, or Enhanced rich text)
-
coresoulMemberMember for: 8 years 3 months 3 days
[#6]: i need your help please
-
Dmitry KozlovAdminMember for: 9 years 8 months 7 days
[#8]: Hi,
You can find samples of getting/setting fields of different types in our blog:
http://formsdesigner.blogspot.com/2013/04/getting-and-setting-sharepoint-form.html