Skip to main content
edited body
Source Link
Ganesh Sanap - MVP
  • 46.4k
  • 22
  • 31
  • 63

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

To mark the field as required - ConsiderTo mark the field as required:

Consider Column name as "Column1"Column1 having ID "Column1ID"Column1ID. Use following script to make it as a required field.

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";

var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;

var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label

var starElement = document.createElement("span") ;

starElement. title = "This is a required field." ;

starElement.textContent = " * " ;

starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";
var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;
var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label
var starElement = document.createElement("span") ;
starElement. title = "This is a required field." ;
starElement.textContent = " * " ;
starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

To mark the field as required - Consider Column name as "Column1" having ID "Column1ID". Use following script to make it as a required field.

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";

var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;

var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label

var starElement = document.createElement("span") ;

starElement. title = "This is a required field." ;

starElement.textContent = " * " ;

starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

To mark the field as required:

Consider Column name as Column1 having ID Column1ID. Use following script to make it as a required field.

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";
var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;
var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label
var starElement = document.createElement("span") ;
starElement. title = "This is a required field." ;
starElement.textContent = " * " ;
starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;
added 646 characters in body
Source Link
Diksha Poddar
  • 424
  • 1
  • 4
  • 12

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

To mark the field as required - Consider Column name as "Column1" having ID "Column1ID". Use following script to make it as a required field.

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";

var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;

var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label

var starElement = document.createElement("span") ;

starElement. title = "This is a required field." ;

starElement.textContent = " * " ;

starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

To mark the field as required - Consider Column name as "Column1" having ID "Column1ID". Use following script to make it as a required field.

var column1 = document.querySelector("div[id^='Column1ID][id$='$TextField_inplacerte']";

var column1TR = column1.parentElement.parentElement.parentElement.parentElement ;

var column1Label = column1TR.querySelector("nobr") ;

// Add Required Asterisk to the Label

var starElement = document.createElement("span") ;

starElement. title = "This is a required field." ;

starElement.textContent = " * " ;

starElement.className = "ms-accenText" ;

column1Label.appendChild(starElement) ;

added 147 characters in body
Source Link
Ganesh Sanap - MVP
  • 46.4k
  • 22
  • 31
  • 63

DontDon't make the columns as required in the list settings. Use custom scriptJavaScript to check the dropdownselected drop-down value.

Based on the selected value selectedyou can make other columns as required as well asor show it using script on the list form.Else Else remove the required condition and hide those columns. By

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

Dont make the columns as required in the list. Use custom script to check the dropdown value.

Based on the value selected make other columns as required as well as show it using script .Else remove the required condition and hide those columns. By this, it will not show the error popup and form will be saved.

Don't make the columns as required in the list settings. Use custom JavaScript to check the selected drop-down value.

Based on the selected value you can make other columns as required or show it on the list form. Else remove the required condition and hide those columns.

By this, it will not show the error popup and form will be saved.

Hide/Show columns in Custom List based on dropdown selection

Source Link
Diksha Poddar
  • 424
  • 1
  • 4
  • 12
Loading