We have created a custom list with a cutom edit form using Visual Studio 2013.
At the bottom of the page, we need to add a button which will perform custom tasks and submit the form for update. I'm currently unsing a "SharePoint:RenderingTemplate" control
For example, on the "click" event of our custom button, we need to assign values based of values entered by the user.
So what I need to do on the client is something like this:
- Call the PreSaveItem method;
- Call our custom method;
- Do a PostBack of the FORM.
As I read, the PreSaveItem method will be a good place to do my stuff, but I cannot discriminate the caller (eg. the SAVE button or my "Custom button")... the event data is not passed to the function;
One way to achieve my goal would be to create a server-side Custom Button with C# code.
But If I were to add a new button using XSLT (in a WebPartPages:DataFormWebPart control) I could do something like this:
<input type="button" id="mySubmit" value="My submit" onclick="javascript: if (!PreSaveItem()) return false; foo(); { ddwrt:GenFireServerEvent('__commit') }"/>
Is it possible to dynamically generate the "onclick" part within my RenderingTemplate?
Thx