I'm trying to hook into the RecordService.RecordSubmitted event in C#. When this event is triggered I need to get the values of the formfields.
I've tried something like this:
XmlDocument recordXml = new XmlDocument();
rcd.ToXml(recordXml);
string name = recordXml.SelectSingleNode("uformrecords/uformrecord/fields/myfield/values/value/text()").InnerText;
But it doesn't seem to work.
Anyone got any experience with this? :-)
Also, what would be the best way to test if it work?
<strong>The current standings are as below. The country besides Sweden that sends the most rockstars to the party wins the Kilmister Trophy and a 10€ discount on the registration fee.</strong> <p> <table width="90%"> <tr> <td>Sweden: <xsl:value-of select="$participantsSweden+$participantsSweden2"/></td> <td>Denmark: <xsl:value-of select="$participantsDenmark+$participantsDenmark2"/></td> <td>Holland: <xsl:value-of select="$participantsHolland+$participantsHolland2"/></td> <td>England: <xsl:value-of select="$participantsEngland+$participantsEngland2"/></td> <td>France: <xsl:value-of select="$participantsFrance+$participantsFrance2"/></td> <td>Germany: <xsl:value-of select="$participantsGermany+$participantsGermany2"/></td> </tr> </table> </p> <p><strong>The following rockstars and leather pants are signed up for booze and party!:</strong></p>
Get values from form on submit in .NET
Hi all,
I'm trying to hook into the RecordService.RecordSubmitted event in C#. When this event is triggered I need to get the values of the formfields.
I've tried something like this:
But it doesn't seem to work.
Anyone got any experience with this? :-)
Also, what would be the best way to test if it work?
Thanks in advance,
- Bo
I have used something like this in the past, to get form values from within a workflow:
To debug you can add entries to the log or attach to the process from Visual Studio.
Hope this helps,
Tom
I have done it in XSLT, but not in C#.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" xmlns:umbraco.contour="urn:umbraco.contour"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary umbraco.contour ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="records" select="umbraco.contour:GetRecordsFromForm('00efeac0-f128-40cc-8b2a-686c706887b8')"/>
<xsl:variable name="participants1" select="count($records//uformrecord)"/>
<xsl:variable name="participants2" select="count($records//uformrecord[.//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="totalParticipants" select="$participants1+$participants2"/>
<xsl:variable name="participantsSweden" select="count($records//uformrecord[.//fields/belongsto//value ='Gislaved'])"/>
<xsl:variable name="participantsSweden2" select="count($records//uformrecord[.//fields/belongsto//value ='Gislaved' and .//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="participantsDenmark" select="count($records//uformrecord[.//fields/belongsto//value ='Ry'])"/>
<xsl:variable name="participantsDenmark2" select="count($records//uformrecord[.//fields/belongsto//value ='Ry' and .//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="participantsHolland" select="count($records//uformrecord[.//fields/belongsto//value ='Haaksbergen'])"/>
<xsl:variable name="participantsHolland2" select="count($records//uformrecord[.//fields/belongsto//value ='Haaksbergen' and .//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="participantsEngland" select="count($records//uformrecord[.//fields/belongsto//value ='Stokesley'])"/>
<xsl:variable name="participantsEngland2" select="count($records//uformrecord[.//fields/belongsto//value ='Stokesley' and .//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="participantsFrance" select="count($records//uformrecord[.//fields/belongsto//value ='Villeneuve-sur-Lot'])"/>
<xsl:variable name="participantsFrance2" select="count($records//uformrecord[.//fields/belongsto//value ='Villeneuve-sur-Lot' and .//fields/yourpartnersfirstname//value !=''])"/>
<xsl:variable name="participantsGermany" select="count($records//uformrecord[.//fields/belongsto//value ='Norderstedt'])"/>
<xsl:variable name="participantsGermany2" select="count($records//uformrecord[.//fields/belongsto//value ='Norderstedt' and .//fields/yourpartnersfirstname//value !=''])"/>
<strong>The current standings are as below. The country besides Sweden that sends the most rockstars to the party wins the Kilmister Trophy and a 10€ discount on the registration fee.</strong>
<p>
<table width="90%">
<tr>
<td>Sweden: <xsl:value-of select="$participantsSweden+$participantsSweden2"/></td>
<td>Denmark: <xsl:value-of select="$participantsDenmark+$participantsDenmark2"/></td>
<td>Holland: <xsl:value-of select="$participantsHolland+$participantsHolland2"/></td>
<td>England: <xsl:value-of select="$participantsEngland+$participantsEngland2"/></td>
<td>France: <xsl:value-of select="$participantsFrance+$participantsFrance2"/></td>
<td>Germany: <xsl:value-of select="$participantsGermany+$participantsGermany2"/></td>
</tr>
</table>
</p>
<p><strong>The following rockstars and leather pants are signed up for booze and party!:</strong></p>
<ol>
<xsl:for-each select="$records/uformrecord">
<xsl:sort select="created"/>
<li><strong><xsl:value-of select=".//fields/yourfirstname//value"/> <xsl:value-of select=".//fields/yourlastname//value"/></strong>, <xsl:value-of select=".//fields/belongsto//value"/><br/><i>Participation: <xsl:value-of select=".//fields/iwishtoparticipate//value"/></i></li>
<xsl:if test=".//fields/yourpartnersfirstname//value !=''"><li><strong><xsl:value-of select=".//fields/yourpartnersfirstname//value"/> <xsl:value-of select=".//fields/yourpartnerslastname//value"/></strong>, <xsl:value-of select=".//fields/belongsto//value"/><br/><i>Participation: <xsl:value-of select=".//fields/mypartnerwishtoparticipate//value"/></i></li></xsl:if>
</xsl:for-each>
</ol>
</xsl:template>
</xsl:stylesheet>
Tom: Thank you! That sure did the trick :-) h5yr
Kalle: Thanks, but I need to do this the C#-way though as there will be lots of other functionality going on when the event occurs.
is working on a reply...