DataForm webpart generated by Collect data from user action

nav
  • DataForm webpart generated by Collect data from user action nav

    Hello I really need help with this... , I am using Sharepoint 2007.

    I have the 'collect data from user' action in a workflow - which generates a custom form within the workflow folder.

    The form uses a DataFormWebPart which contains xsl stylesheet. It has a 'Complete Task' button as below:

    <td><input type="button" name="btnMarkSubmited" value="Complete Task" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}"></input></td>
    

    I need to add javascript within the DataFormWebPart so I can update another form field when the user clicks the 'Complete Task' button.

    I have tried adding a content editor webpart and used jquery to update a a form field value when the button is clicked as such

    $(document).ready(function (){
    $("input[type=button][value='Complete Task']").click(function(){
    $("input[type=checkbox]").attr("checked", true);
    });
    

    This changes the form field succesfully but does not save to the list when the form submits. I have also tried to call a javascript function from within the onclick but it does not find the function when placed in the content editor webpart (or within placeholdermain template).

    Please could someone give me any ideas on this? I have pasted the form's DataFormWebPart below for reference:

    Many Thanks!

    <WebPartPages:DataFormWebPart runat="server" IsIncluded="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="0" Title="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}" __markuptype="vsattributemarkup" __WebPartId="{9A02BCE0-AAE3-4A75-A736-8789BF8C9AF9}" id="TaskForm" pagesize="1" datasourceid="SPDataSource2">
        <DataSources>
            <SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" UseInternalName="true" selectcommand="&lt;View&gt;&lt;ViewFields&gt;&lt;FieldRef Name=&quot;ID&quot;/&gt;&lt;FieldRef Name=&quot;PermMask&quot;/&gt;&lt;/ViewFields&gt;&lt;/View&gt;" id="SPDataSource2"><SelectParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}"/><WebPartPages:DataFormParameter Name="listitemid" ParameterKey="listitemid" PropertyName="ParameterValues"/><asp:Parameter Name="StartRowIndex" DefaultValue="0"/><asp:Parameter Name="nextpagedata" DefaultValue="0"/><asp:Parameter Name="MaximumRows" DefaultValue="1"/></SelectParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}"/></DeleteParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}"/></InsertParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}"/></UpdateParameters></SharePoint:SPDataSource>
        </DataSources>
        <ParameterBindings>
            <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
            <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
            <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
            <ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
            <ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
            <ParameterBinding Name="dvt_nextpagedata" Location="Postback;Connection"/>
            <ParameterBinding Name="ListID" Location="None" DefaultValue="{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}"/>
            <ParameterBinding Name="listitemid" Location="QueryString(ID)" DefaultValue=""/>
            <ParameterBinding Name="Id" Location="QueryString(ID)" DefaultValue="0"/>
            <ParameterBinding Name="ListName" Location="QueryString(List)" DefaultValue=""/>
        </ParameterBindings>
        <datafields>@Title,Title;@Priority,Priority;@Status,Status;@PercentComplete,% Complete;@AssignedTo,Assigned To;@TaskGroup,Task Group;@Body,Description;@StartDate,Start Date;@DueDate,Due Date;@Holiday_x0020_Request_x0020_Appr,Holiday Request Approve Status;@Complete,Complete;@HolidayRequestRefID,HolidayRequestRefID;@WorkflowLink,Link;@OffsiteParticipant,External Participant;@OffsiteParticipantReason,External Participant Reason;@WorkflowOutcome,Outcome;@WorkflowName,Workflow Name;@ContentType,Content Type;@Related_x0020_request_x0020_item,Related request item;@Holiday_x0020_Request_x0020_Stat,Holiday Request Status;@Comments1,Comments;@TaskCrea,Task Created;@TaskModi,Task Modified;@Reviewed,Reviewed;@TaskIDNum,TaskIDNum;@StatusUpdate,StatusUpdate;@ID,ID;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;</datafields>
        <XSL>
    <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
    
    
    
     <xsl:output method="html" indent="no"/>
        <xsl:decimal-format NaN=""/>
        <xsl:param name="dvt_apos">&apos;</xsl:param>
        <xsl:param name="dvt_firstrow">1</xsl:param>
        <xsl:param name="dvt_nextpagedata" />
        <xsl:param name="ListID">{BC399A4C-0DB0-4BE7-9542-CD8001CC2902}</xsl:param>
        <xsl:param name="listitemid" />
        <xsl:param name="Id">0</xsl:param>
        <xsl:param name="ListName" />   
        <xsl:variable name="dvt_1_automode">0</xsl:variable>
    
    
    
    
        <xsl:template match="/">
            <xsl:call-template name="dvt_1"/>
        </xsl:template>
        <xsl:template name="dvt_1">
            <xsl:variable name="dvt_StyleName">RepForm3</xsl:variable>
            <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
            <xsl:variable name="dvt_RowCount" select="count($Rows)" />
            <xsl:variable name="RowLimit" select="1" />
            <xsl:variable name="FirstRow" select="$dvt_firstrow" />
            <xsl:variable name="LastRow" select="$FirstRow + $dvt_RowCount - 1" />
            <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
            <xsl:call-template name="dvt_1.header">
                <xsl:with-param name="Rows" select="$Rows" />
            </xsl:call-template>
            <table border="0" width="100%">
                <xsl:call-template name="dvt_1.body">
                    <xsl:with-param name="Rows" select="$Rows"/>
                    <xsl:with-param name="FirstRow" select="1" />
                    <xsl:with-param name="LastRow" select="$dvt_RowCount" />
                </xsl:call-template>
            </table>
            <xsl:call-template name="dvt_1.commandfooter">
                <xsl:with-param name="FirstRow" select="$FirstRow" />
                <xsl:with-param name="LastRow" select="$LastRow" />
                <xsl:with-param name="RowLimit" select="$RowLimit" />
                <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                <xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />
            </xsl:call-template>
        </xsl:template>
        <xsl:template name="dvt_1.body">
            <xsl:param name="Rows"/>
            <xsl:param name="FirstRow" />
            <xsl:param name="LastRow" />
            <xsl:for-each select="$Rows">
                <xsl:variable name="dvt_KeepItemsTogether" select="false()" />
                <xsl:variable name="dvt_HideGroupDetail" select="false()" />
                <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">
                    <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
                        <xsl:call-template name="dvt_1.rowedit">
                            <xsl:with-param name="Pos" select="concat('_', position())" />
                        </xsl:call-template>
                    </xsl:if>
                </xsl:if>
            </xsl:for-each>
    
        </xsl:template>
        <xsl:template name="dvt_1.rowedit">
            <xsl:param name="Pos" />
            <tr>
                <td>
                    <table border="0" cellspacing="0" width="100%"><tr><td class="ms-formlabel" valign="top" nowrap="true" width="25%"><b>Title:</b></td><td class="ms-formbody" valign="top" width="75%">Collect approval status<br></br><br></br></td></tr>
                        <tr>
                            <td width="25%" class="ms-formlabel">
                                <b>Holiday Request Status:</b>
                            </td>
                            <td width="75%" class="ms-formbody">
                                <SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Holiday_x0020_Request_x0020_Stat" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Holiday_x0020_Request_x0020_Stat')}"/>
                                <SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Holiday_x0020_Request_x0020_Stat" ControlMode="Edit"/>
                            </td>
                        </tr>
                        <tr>
                            <td width="25%" class="ms-formlabel">
                                <b>Comments:</b>
                            </td>
                            <td width="75%" class="ms-formbody">
                                <SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="Edit" FieldName="Comments1" __designer:bind="{ddwrt:DataBind('u',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Comments1')}"/>
                                <SharePoint:FieldDescription runat="server" id="ff2description{$Pos}" FieldName="Comments1" ControlMode="Edit"/>
                            </td>
                        </tr>
                        <tr >
                            <td width="25%" class="ms-formlabel">
                                <b>Reviewed:</b>
                            </td>
                            <td width="75%" class="ms-formbody">
                                <SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="Edit" FieldName="Reviewed" />
                                <SharePoint:FieldDescription runat="server" id="ff3description{$Pos}" FieldName="Reviewed" ControlMode="Edit"/>
                            </td>
                        </tr>
                        <tr style="display:none">
                            <td width="25%" class="ms-formlabel">
                                <b>TaskIDNum:</b>
                            </td>
                            <td width="75%" class="ms-formbody">
                                <SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="Edit" FieldName="TaskIDNum" __designer:bind="{ddwrt:DataBind('u',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@TaskIDNum')}"/>
                                <SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="TaskIDNum" ControlMode="Edit"/>
                            </td>
                        </tr>
                        <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
                            <tr>
                                <td colspan="99" class="ms-vb">
                                    <span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="edit"></span>
                                </td>
                            </tr>
                        </xsl:if>
                    <tr><td class="ms-formlabel" valign="top" nowrap="true" width="25%"><b>Related list item:</b></td><td class="ms-formbody" valign="top" width="75%"><a href="{substring-before(@WorkflowLink, ', ')}"><xsl:value-of select="substring-after(@WorkflowLink, ', ')"></xsl:value-of></a></td></tr></table>
                </td>
            </tr>
    
        </xsl:template>
        <xsl:template name="dvt_1.commandfooter">
            <xsl:param name="FirstRow" />
            <xsl:param name="LastRow" />
            <xsl:param name="RowLimit" />
            <xsl:param name="dvt_RowCount" />
            <xsl:param name="RealLastRow" />
            <table cellspacing="0" cellpadding="4" border="0" width="100%">
                <tr>
                    <xsl:call-template name="dvt_1.formactions" />
                    <xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata"></xsl:if>
                </tr>
            </table>
        </xsl:template>
        <xsl:template name="dvt_1.formactions">
            <td nowrap="nowrap" class="ms-vb">
                <input type="button" value="Save Draft" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__update;__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" />
            </td><td><input type="button" name="btnMarkSubmited" value="Complete Task" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__update;__workflowTaskComplete={',ddwrt:EcmaScriptEncode(string($Id)),'*',ddwrt:EcmaScriptEncode($ListName),'};__commit;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}"></input></td>
            <td nowrap="nowrap" class="ms-vb" width="99%">
                <input type="button" value="Cancel" name="btnCancel" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__cancel;__redirectsource;__redirectToList={',ddwrt:EcmaScriptEncode($ListName),'};'))}" />
            </td></xsl:template>
        <xsl:template name="dvt_1.header">
            <xsl:param name="Rows" />
            <table cellSpacing="0" cellPadding="4" border="0" width="100%">
                <tr>
                    <td class="ms-vb">
                        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
                    </td>
                </tr>
            </table>
        </xsl:template>
    </xsl:stylesheet>   </XSL>
    </WebPartPages:DataFormWebPart>
    

  • Would I be right in thinking that the Workflow action triggered by the button's OnClick is triggered before your jQuery click event? This would mean the form data is captured and the list updated before the jQuery updates your form field...

    In which case, try updating the form field from within the Workflow itself rather than the jQuery?

Tags
data-view-web-part workflow 2007
Related questions and answers
  • I have this (an attempt to solve the task): &lt;xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes.../@Distance[1]"/&gt;&lt;/xsl:call-template>; &lt;xsl:template name="xsum"&gt; &lt;xsl:param name="currnode"/&gt; &lt;xsl:param name="res" select="0"/&gt; &lt;xsl...:internal"&gt; &lt;xsl:output method="html" indent="no"/&gt; &lt;xsl:decimal-format NaN=""/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row

  • (ContactPicker.OnEditBoxFocus(this, event));&quot; title=&quot;&quot; tabIndex=0&gt;&lt;/DIV>&lt;/DIV>&lt;/SPAN>&lt;/TD>; &lt;TD vAlign=top>&lt;BUTTON id=V1_I1_CP2_ResolveButton onfocus=&quot;return.... &lt;TABLE>;&lt;TBODY> &lt;TR>; &lt;TD vAlign=top>&lt;BUTTON style=&quot;FONT-STYLE: normal; FONT-FAMILY: Segoe UI; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none" id...&quot;&gt; &lt;SPAN style=&quot;VERTICAL-ALIGN: middle"&gt;Кому: &lt;/SPAN>&lt;/NOBR>&lt;/BUTTON>&lt;/TD>; &lt;TD style=&quot;WIDTH: 100%&quot;&gt;&lt;SPAN onmouseover=&quot;return

  • Hiding Left Nav user1155

    ="LeftNavTableCell" runat="server"&gt; &lt;table cellpadding="0" cellspacing="0" id="LeftNav"&gt; &lt;tr>; &lt;td style="width:301px; text-align:left; vertical-align:top...="0" cellspacing="0" border="0"&gt; &lt;tr>; &lt;td>; &lt;table class="ms-navheader" width="100%" cellpadding="0" cellspacing="0" border="0"&gt; &lt;tr>; &lt;td nowrap="nowrap" id="idSiteHierarchy"&gt; &lt;SharePoint:SPLinkButton runat="server

  • ;Value Type=&amp;quot;Counter&quot;&amp;gt;{ID}&amp;lt;/Value&gt;&amp;lt;/Eq&gt;&amp;lt;/Where&gt;&amp;lt;OrderBy&gt;&amp;lt;FieldRef Name=&amp;quot;PublishedDate&quot; Ascending...="server" DataSourceMode="List" UseInternalName="true" selectcommand="&amp;lt;View&gt;&amp;lt;Query&gt;&amp;lt;Where&gt;&amp;lt;Eq&gt;&amp;lt;FieldRef Name=&amp;quot...;gt;&amp;lt;FieldRef Name=&amp;quot;PermMask&quot;/&amp;gt;&amp;lt;/ViewFields&gt;&amp;lt;/View&gt;"&gt;&lt;SelectParameters>&lt;asp:Parameter Name="ListID" DefaultValue

  • ="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"&gt; &lt;xsl:template match="FieldRef[@FieldType='DataLinkUrl']" mode="Note_body"&gt; &lt;xsl:param name="thisNode" select="."/&gt; &lt;xsl...Has anybody upgraded an old custom field type to use the new XSL transform in SharePoint 2010? I have a multi-column field type, and want the Display pattern to render the 2nd "column", which.../dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer

  • ;Lawrence</label>&lt;/td>; &lt;/tr>; &lt;/table>;&lt;input type="submit" name="ctl00$m$g_583145bb_3463_40cc_b5ef_6f42c371f376$btnAnswer" value="Answer" id="ctl00_m_g_583145bb_3463_40cc_b5ef_6f42c371f376_btnAnswer" class="ms-buttonheightwidth" /&gt;&lt;input type="submit" name="ctl00$m$g_583145bb_3463_40cc_b5ef_6f42c371f376$btnSkip" value="Skip Question" id...="ctl00_m_g_583145bb_3463_40cc_b5ef_6f42c371f376_ctl02" border="0"&gt; &lt;tr>; &lt;td>;&lt;input id="ctl00_m_g_583145bb_3463_40cc_b5ef_6f42c371f376_ctl02_0

  • ; &lt;/table>; &lt;/td>; &lt;/tr>; &lt;/table>; &lt;table width="579" border="0" cellspacing="0" cellpadding="0" class="bg"&gt; &lt;tr>; &lt;td width="100%" align="center" valign="top"&gt; &lt;table width="530" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr>; &lt;td...; } &lt;table width="579" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr>; &lt;td class="permission"&gt; &lt;p>You're

  • ()); } UPDATE: Based on feedback from Wictor, I tried the following: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;webParts> &lt;webPart xmlns="http://schemas.microsoft.com/WebPart/v3"&gt; &lt...\"?&gt;" + "&lt;webParts>&lt;webPart xmlns=\"http://schemas.microsoft.com/WebPart/v3\"&gt;" + "&lt;metaData>" + "&lt;type name...;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"; //webPartXml = webPartXml + "&lt;WebPart xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns

  • I can create a CQWP for the Announcement content type, but when I export the .webpart and add &lt;property name="CommonViewFields" type="string"&gt;Expires,Date;Body,text</property> In my ItemStyles.xsl I have added this to show all the returned fields &lt;xsl:template name="ShowXML" match="Row[@Style='ShowXML']" mode="itemstyle"&gt; &lt;xsl:for-each select="@*"&gt; &lt;br /&gt; Name: &lt;xsl:value-of select="name()" /&gt; &lt;br /&gt;Value:&lt;xsl:value-of select="." disable-output-escaping="yes"/&gt; &lt;/xsl:for-each> &lt;/xsl:template>

Data information