문제

I have already set the maximum length, but now I need the user to enter not less than a certain amount

This is the script I'm using :

function PreSaveAction() {
var control = getElementByID("IBAN(24 Digits Alpha Numeric)");
 if(control.value.length < 24) 
 { 
  alert("The length in this field should not be less than 24 chars"); 
  return false; // Cancel the item save process 
 } 
else { return true ;}
}
도움이 되었습니까?

해결책

SharePoint OOTB Solution:

Use Column Validation:

  1. Go to your list settings.
  2. Click on your text column.
  3. Move to column validation section and enter below expression:

    =LEN([your column name])>24

And you can enter some message in user message section.

JavaScript Approach:

Try using below code:

Assuming the display name of your field is "IBAN(24 Digits Alpha Numeric)".

var control = document.querySelector("input[title^='IBAN(24 Digits Alpha Numeric)']");

다른 팁

Please try below code to get the control element:

var control = WebForm_GetElementById("IBAN(24 Digits Alpha Numeric)");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top