如何在 sharepoint 2010 中从拼写检查中排除字段?
我的页面布局中有一个 SharePointWebControls:UserField
,需要将其排除在拼写检查之外,否则每当选择用户时,都会在代码隐藏中检测到大量拼写错误控制。
似乎在 Sharepoint 2007 中可以通过使用 excludefromspellcheck = "true"
来实现此行为,但这似乎不适用于 Sharepoint 2010。有没有人遇到过同样的问题并找到解决方法?
I have a SharePointWebControls:UserField
in a page layout that needs to be excluded from spell checking, as otherwise whenever a user is selected there are a large number of spelling errors are detected in the code-behind for the control.
It seems that in Sharepoint 2007 this behaviour could be implemented by using excludefromspellcheck = "true"
but this doesn't seem to work for Sharepoint 2010. Has anyone come across the same problem and found a way around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
基于SpellCheckEntirePage.js,这似乎仍然是这样:
但exclusionFromSpellCheck不是UserField,因此它可能不会自动复制到呈现的 HTML。呈现时,UserField 控件由多个元素组成。我会尝试查看“查看源代码”,看看 exceptFromSpellCheck 是否将其纳入最终的 HTML 中。但要在适当的元素上设置属性,您可能需要使用一些 jQuery,如下所示:
Based on SpellCheckEntirePage.js, that appears to still be the way:
But excludeFromSpellCheck is not a property of UserField, so it probably won't automatically copy down to the rendered HTML. When rendered, the UserField control is made up of several elements. I would try looking at the View Source to see if excludeFromSpellCheck is making it into the final HTML. But to set the attribute on the appropriate elements, you might need to use some jQuery like this:
您可以通过在不希望进行拼写检查的文本区域和输入控件上将“excludeContentFromSpellCheck”属性设置为“true”来禁用某些字段的拼写检查。
我在所有页面布局上都这样做了。现在我不再收到误报了。
解决方案是在您不想进行拼写检查的字段周围添加一个 div 标签,并添加一个 javascript,将 div 标签内的元素的“excludeFromSpellCheck”设置为“true”。
我找到的解决方案如下所述:SharePoint 发布页面上的拼写检查不准确
You can disable the spell check for certain fields by setting the "excludeContentFromSpellCheck" attribute to "true" on text area and input controls that you dont want to be spell checked.
I did this on all my page layouts. Now i dont get false positives anymore.
The solution is to add a div tag around the fields you don't want spell checked and adding a javascript that sets "excludeFromSpellCheck" to "true" for the elements within the div tag.
The solution i found is described here: Inaccurate Spell Check on SharePoint Publishing Pages
Joe Furner 发布了这个解决方案,它对我有用。
https://www.altamiracorp.com/blog/employee -posts/spell-checking-your-custom-lay
它排除页面上的所有 PeoplePicker:
Joe Furner posted this solution, which has worked for me.
https://www.altamiracorp.com/blog/employee-posts/spell-checking-your-custom-lay
It excludes all PeoplePickers on the page:
此代码仅部分工作,因为如果您再次放置人员选择器值,请检查人员选择器垃圾值一次。
This code is working partially only,because if you put the people picker value again checking the people picker garbage value for one time.