domingo, 25 de abril de 2010

Preseleccionar u ocultar valores en las pantallas de alta

Hace un tiempo me consultaron sobre como preseleccionar u ocultar valores en las pantallas de alta de SharePoint tomando los datos de parámetros de la URL.

Preseleccionar valores

Bien, hay muchas opciones. Una de las que más he utilizado es la solución con JavaScript descripta en el Blog oficial de SharePoint Designer de MSDN. Funciona bien y data del año 2007:
Hi, my name is Rob Howard, and I’m a Program Manager with the SharePoint Designer team. Like several of the other people posting here, I also built many of the Application Templates for Windows SharePoint Services.
If you’re familiar with them, you may have noticed that in several of the application templates we use a bit of Javascript to set default form values based on the query string. Because we found this to be useful in many different cases throughout our applications, I wanted to share our method with you guys so that you can include it in the applications you develop.
When might you use this?
It’s pretty easy to set a field’s default value through the list settings in the browser UI, so why might you need Javascript to set a default field value? The reason is that field default values can only take static values or simple formulae based on the current user or today’s date. If that meets your needs, then I’d definitely recommend sticking with that method. Sometimes, though, you may want the form to fill with default values based on the user’s interaction with the previous page, and that’s exactly where this method comes in.
How does it work?
In short, we add some Javascript to the page that runs when the body is loaded. This Javascript parses the page’s query string, locates the HTML objects that are rendered by the relevant SharePoint fields, and sets their value based on the information in the query string.
Pueden encontrar la solución completa en:

Ocultar campos

image Para esto también hay una solución del año 2008 que pueden encontrar en Clever Workarounds, basada en JavaScript y que he probado numerosas veces.
Para entender esta solución, les recomiendo que lean esta serie de artículos que pueden encontrar en la home page del sitio:
SharePoint Branding Series 2

Espero que les sea útil. Hasta la próxima!

0 comentarios:

Publicar un comentario en la entrada