Reputation: 3
I have a website that was done in Modx(yuck) and using FormIt I created a simple page with 1 field, an email textbox.
<form method="post" action="" id="1">
<label for="advisorName">Email Address:</label><input id="email" type="text" name="email" value=""></form>
How can I get the email field populated from an url like:
www.example.com/unsubscribe.html?id=1&[email protected]
This is easy for me with a standard website, but I am so lost with Modx.
Upvotes: 0
Views: 538
Reputation: 2281
Read the docs - http://rtfm.modx.com/extras/revo/formit/formit.hooks/formit.hooks.email
[[!FormIt?
&emailTo=`[[+addressTo]]`
]]
...
<select name="addressTo">
<option value="[email protected]" [[!+fi.addressTo:FormItIsSelected=`[email protected]`]]>John</option>
<option value="[email protected]" [[!+fi.addressTo:FormItIsSelected=`[email protected]`]]>Jane</option>
</select>
or if you just need to get email field - http://rtfm.modx.com/extras/revo/formit/formit.tutorials-and-examples/formit.examples.custom-hook
Upvotes: 1
Reputation: 794
You want to create a "Snippet", which is just a piece of php code. Call your snippet whatever and something like this should do:
return (!empty($_GET['email']) ? $_GET['email'] : 'Enter e-mail');
Then in your chunk/template or wherever that code you pasted is, change the input value to: value="[[!NameOfYourSnippet]]"
. The bracers indicate that it's a snippet you want to call and the exclamation mark tells modx not to cache whatever is rendered by it.
Happy modx:ing!
Upvotes: 0