Saturday, January 21, 2012

To use one-liner or not to use one-liner?

A recurring problem in many of the projects I'm working on is a link to open a link up in a pop / model window. My first thought was to do as Venkatesh R've described it here By making a new SP.UI. $ create_DialogOptions (); object and call SP.UI.ModalDialog.showModalDialog. Not because it's hard but if you do not need the callback. So it is easier to do as described in the SharePoint Developer Team Blog whereas in a one-liner can open link in a model window.
<div id="displayDiv"> <p> Please help us with our survey. Take our poll now! </ P> <input onclick = "javascript: SP.UI.ModalDialog.showModalDialog ({url: '.. / Lists / GBE / NewForm.aspx', title: 'User Survey'}); return false; "id =" btnVote "type =" button "value =" Vote "/> </ div>

Which approach would you choose? Post a comment with your solution.