如何在InfoPath表单中禁用People Picker字段的拼写检查?
Hey there! I’ve dealt with this exact issue before—disabling spell check for the People Picker in InfoPath can be tricky since standard code snippets often don’t target that specific control. Here’s a detailed, step-by-step guide that should work for you:
Step 1: Open Your InfoPath Form in Design Mode
- Launch InfoPath Designer and open the form template you need to modify.
- Navigate to the People Picker control you want to adjust.
Step 2: Enable Custom Scripting & Add Targeted JavaScript
First, you need to turn on custom scripting for your form (it’s disabled by default):
- Go to the File tab > Options > Advanced.
- Scroll down to the General section and check the box for Enable custom scripting.
- Save your form to apply this change.
Next, add the JavaScript that will disable spell check for the People Picker:
- Go to the Home tab > Add > More Controls > select Script Editor (under the HTML category) and drop it anywhere on your form (it won’t show up in the published version).
- Double-click the Script Editor to open the HTML editor, then paste this code:
// Wait for the page to fully load before targeting elements window.addEventListener('load', function() { // Target all People Picker input elements (update the title if yours is custom) const peoplePickerInputs = document.querySelectorAll('input[title="People Picker"]'); peoplePickerInputs.forEach(input => { // Disable spell check, autocorrect, and autocapitalize input.setAttribute('spellcheck', 'false'); input.setAttribute('autocorrect', 'off'); input.setAttribute('autocapitalize', 'off'); }); });
- Quick note: If your People Picker has a custom title (check via right-click > Properties > General tab), replace
"People Picker"in the code with your control’s actual title.
Step 3: Test the Change
- Preview or publish your form, then type in the People Picker field. You should no longer see red spell check underlines for names or entries.
Alternative: Check for Built-In Control Settings (If Applicable)
Depending on your InfoPath version, there might be a simpler way:
- Right-click the People Picker control > Properties.
- Navigate to the Display or Advanced tab (varies by version).
- Look for an option like Disable spell check or set Spell check to "Off"—enable this if it’s available.
- Save and test the form to confirm.
内容的提问来源于stack exchange,提问作者Shandeep AM
相关产品推荐
相关产品推荐

