Required Field based on user Selection
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 Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
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
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
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();
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();
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
This code works well for me:
Please, make sure that you use the correct internal name of the field and that the field type is Choice (DropDown).
Code: Select all
fd.field('AFH_x0020_Replacement_x0020_Reas').value('');
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
What type of the multiline text field do you use: Plain text, Rich text, or Enhanced rich text?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
You can find samples of getting/setting fields of different types in our blog:
http://spform.com/forms-designer- ... eld-values
You can find samples of getting/setting fields of different types in our blog:
http://spform.com/forms-designer- ... eld-values
-
- Information
-
Who is online
Users browsing this forum: No registered users and 16 guests