Form submission control
In the process of building YIDA applications, you may encounter the following problems.
- How to manage daily reportsIn the system, setOnly one daily report data is allowed per person per day, and repeated submission is not allowed on the same day..
- How to manage weekly reportsIn the system, setOnly one weekly report can be submitted per person per week, and repeated submission is not allowed in that week..
- How to manage monthly reportsIn the system, setOnly one weekly report can be submitted per person per month, and repeated submission is not allowed for the current month..
- In the questionnaire or activity registration system, only one data can be submitted by each person, and the same person is not allowed to submit it repeatedly.
Prerequisites
This tutorial uses the form formula of YIDA. You can first understand the followingForm formula.
Effect
Each person can only submit once a day.
Each person can only submit once a week.
Each person can only submit once a month.
Each person can only submit it once.
Implementation steps
Each person can only submit once a day.
Create a common form page
Create a common form page. For more information, seeCommon form.
Drag the following components into the canvas area.
- Member: Named as the author
- Date: Named as the submission date
- Single line text: Named as a unique verification identifier
- Component status settings hide and check always submit
Add Form formula
The submitter selects the shortcut configuration. By default, the current user is logged in.
Select quick configuration for the submission date. The default value is today.
Select Edit formula and configure the formula shown in the following figure. You can also directly copy the formula source code and modify the fields.
Use the userId of the current logon user + the date of submission to set the unique verification identifier.
{"text":"CONCATENATE(USERFIELD(提交人,\"userId\"),TEXT(DATE(提交日期),\"yyyyMMdd\"))","marks":[{"from":{"line":0,"ch":22,"sticky":null},"to":{"line":0,"ch":27,"sticky":null},"value":"employeeField_lc0bktqq","invalid":false},{"from":{"line":0,"ch":48,"sticky":null},"to":{"line":0,"ch":54,"sticky":null},"value":"dateField_lc0bktqr","invalid":false}],"isCmData":true}
Add Form verification
Use the EXIST function to verify the unique verification identifier.
{"text":"EXIST(唯一校验标识)","marks":[{"from":{"line":0,"ch":6,"sticky":null},"to":{"line":0,"ch":14,"sticky":null},"value":"textField_lc0bcyfu","invalid":false}],"isCmData":true}
Save page
Each person can only submit once a week.
Create a common form page
Create a common form page. For more information, seeCommon form.
Drag the following components into the canvas area.
- Member: Named as the author
- Date: Named as the submission date
- Single line text: Named as a unique verification identifier
- Component status settings hide and check always submit
Add Form formula
The submitter selects the shortcut configuration. By default, the current user is logged in.
Select quick configuration for the submission date. The default value is today.
Select Edit formula and configure the formula shown in the following figure. You can also directly copy the formula source code and modify the fields.
Use the userId of the current logon user + the date of submission + the number of weeks of submission date to set a unique verification identifier.
{"text":"CONCATENATE(USERFIELD(提交人,\"userId\"),TEXT(DATE(提交日期),\"yyyyMM\"),MID(TEXT(ISOWEEKNUM(DATE(提交日期))),2,LEN(TEXT(ISOWEEKNUM(DATE(提交日期))))-2))","marks":[{"from":{"line":0,"ch":22,"sticky":null},"to":{"line":0,"ch":27,"sticky":null},"value":"employeeField_lc0bktqq","invalid":false},{"from":{"line":0,"ch":48,"sticky":null},"to":{"line":0,"ch":54,"sticky":null},"value":"dateField_lc0bktqr","invalid":false},{"from":{"line":0,"ch":91,"sticky":null},"to":{"line":0,"ch":97,"sticky":null},"value":"dateField_lc0bktqr","invalid":false},{"from":{"line":0,"ch":128,"sticky":null},"to":{"line":0,"ch":134,"sticky":null},"value":"dateField_lc0bktqr","invalid":false}],"isCmData":true}
Add Form verification
Use the EXIST function to verify the unique verification identifier.
{"text":"EXIST(唯一校验标识)","marks":[{"from":{"line":0,"ch":6,"sticky":null},"to":{"line":0,"ch":14,"sticky":null},"value":"textField_lc0bcyfu","invalid":false}],"isCmData":true}
Save page
Each person can only submit once a month.
Create a normal form page
Create a common form page. For more information, seeCommon form.
Drag the following components into the canvas area.
- Member: Named as the author
- Date: Named as the submission date
- Single line text: Named as a unique verification identifier
- Component status settings hide and check always submit
Add Form formula
The submitter selects the shortcut configuration. By default, the current user is logged in.
Select quick configuration for the submission date. The default value is today.
Select Edit formula and configure the formula shown in the following figure. You can also directly copy the formula source code and modify the fields.
Use the userId of the current logon user + the date of submission to set a unique verification identifier.
{"text":"CONCATENATE(USERFIELD(提交人,\"userId\"),TEXT(DATE(提交日期),\"yyyyMM\"))","marks":[{"from":{"line":0,"ch":22,"sticky":null},"to":{"line":0,"ch":27,"sticky":null},"value":"employeeField_lc0bktqq","invalid":false},{"from":{"line":0,"ch":48,"sticky":null},"to":{"line":0,"ch":54,"sticky":null},"value":"dateField_lc0bktqr","invalid":false}],"isCmData":true}
Add Form verification
Use the EXIST function to verify the unique verification identifier.
{"text":"EXIST(唯一校验标识)","marks":[{"from":{"line":0,"ch":6,"sticky":null},"to":{"line":0,"ch":14,"sticky":null},"value":"textField_lc0bcyfu","invalid":false}],"isCmData":true}
Save page
Each person can only submit it once.
Create a normal form page
Create a common form page. For more information, seeCommon form.
Drag the following components into the canvas area.
- Member: Named as the author
- Date: Named as the submission date
Save page
Set submission rules
Go to the page settings.
Set commit rules and save them.