How to add a hidden value to a form

Topics: General, Troubleshooting
Jun 8, 2011 at 7:51 PM

This should be easy, but I just can't figure out how to add a hidden value with an aiutopopualte of remote_address to the conact form through xslt function.

 

Thanks!

Jun 8, 2011 at 9:28 PM

Below is C1 Function call markup and an XSLT document that produce a hidden input field with user ip as value. Short video at http://www.screenr.com/zcss

<f:functions xmlns:f="http://www.composite.net/ns/function/1.0">
  <f:function name="Composite.Web.Server.ServerVariable" localname="remote_addr">
    <f:param name="VariableName" value="REMOTE_ADDR" />
  </f:function>
</f:functions>

-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:in="http://www.composite.net/ns/transformation/input/1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xsl in">
  <xsl:template match="/">
    <html>
      <head>
        <!-- markup placed here will be shown in the head section of the rendered page -->
      </head>
      <body>
        <div>
          
          <input type="hiddden"
                  name="user_ip"
                  value="{/in:inputs/in:result[@name='remote_addr']}" />
          
        </div>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>