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.
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>
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
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:
Hope that's kinda like what you're looking for,
/Chriztian
Hi Chriztian,
Thanks for your reply. I'm going to have a crack at this now...
Barney
is working on a reply...