Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • BarneyHall 141 posts 210 karma points
    Dec 09, 2009 @ 19:27
    BarneyHall
    0

    Passing docType properties to an enquiry form

    Hello smashing umbraco peeps.

    I need to create a means of linking a job post (quite literally just a page doc, e.g. like a news item) to a form, where the job title and ref is passed to the enquiry form.

    I've setup a docType for the job post, and the properties Job Title and Job Ref have been created amongst others that the client will complete when creating a new Job Post.

    My question is how best to approach passing the value of these properties so that a linked form has these field pre-populated before the user submits it?

    I've has some success with re-using Warren's CWS contact form, but wiring it up to do the above is quite another matter... !

    Any help/advice would be gratefully received as ever.

    Many thanks,
    Barney

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 09, 2009 @ 22:04
    Chriztian Steinmeier
    0

    Hi,

    If your link to the form page has the id of the Job Page (or another identifier, say, a "jobID" property) in its QueryString, you can grab that Id in the form page and with XSLT find the jobPage, extract the two properties and prefill the input fields - something along the lines of this:

       <xsl:param name="currentPage" />
        <xsl:variable name="root" select="$currentPage/ancestor-or-self::root" />
    
        <xsl:variable name="jobID" select="umbraco.library:RequestQueryString('jobid')" />
        <xsl:variable name="jobPage" select="$root//node[data[@alias = 'jobID'] = $jobID]" />
    
        <xsl:template match="/">
    
            <!-- All the other stuff you might do - create form etc... -->
    
            <!-- Prepopulate Job fields -->
            <input type="hidden" id="JobTitle" value="{$jobPage/data[@alias = 'JobTitle']}" />
            <input type="hidden" id="JobRef" value="{$jobPage/data[@alias = 'JobRef']}" />
    
            <!-- Close form etc... -->
    
        </xsl:template>
    

    Hope that's kinda like what you're looking for,

    /Chriztian

  • BarneyHall 141 posts 210 karma points
    Dec 11, 2009 @ 17:24
    BarneyHall
    0

    Hi Chriztian,

    Thanks for your reply. I'm going to have a crack at this now...

    Barney

Please Sign in or register to post replies

Write your reply to:

Draft