- Use the JavaScript 'window.prompt' method? Too ugly and limited style and validation options.
- Incorporate a jQuery plugin that makes for easy prompting? May or may not work with SharePoint, and even then it will most likely have a UI style that is different.
- Use the SharePoint dialog API to show a modal page? Close - but that means we have to create and deploy an entire ASPX or HTM page to show within the dialog. That is a lot for what boils down to a label and a text box.
- Embed the script below and move on to checking on your Klout status.
Yeah, I like #4 too - except for the Klout part.
What this script does:
- Shows a SharePoint modal dialog and injects content and style, so it looks like the rest of your UI.
- Does not require you to build another page for the dialog UI.
- Returns the text the user entered.
- Validates that the user typed in something by default. You can optionally provide a maximum length or a custom validation function to use.
- Requires jQuery. Probably could be written to be dependency-free, but that would be many more lines of code - especially the CSS cloning part.
No comments:
Post a Comment