Can anyone point me in the direction of a thread or tutorial on how to populate eForm with data from a logged in web user??? I tried using eFormPopulate but it throws an error:
Fatal error: Call to undefined function eFormPopulate() in /nfs/c04/h03/mnt/66374/domains/sbgroovygrooms.com/html/assets/snippets/eform/eform.inc.php on line 136
I’d like to prepopulate eForm with data such as fullname, email, and street address. Is there a way to take the UserPlaceHolder and use attributes from the WebLoginPE extended table? I’m newer at this but I can catch on pretty quick I just can’t find any info. Any help is much appreciated!
I twitch because I care....and drink too much coffee.
-
☆ A M B ☆
- 24,524 Posts
Did you create a snippet with the eformpopulate function? Did you call your snippet before calling eform?
I did...or I’m pretty sure I did
[!UserPlaceholders?!]
[!eFormPopulate!]
[!eForm? &formid=`feedbackForm` &to=`[email protected]` &tpl=`requestForm` &report=`eFeedbackReport` &thankyou=`eFeedbackThanks` &vericode=`0` &subject=`Appointment Request` &eFormOnBeforeFormParse=`eformpopulate`!]
I noticed my snippet order was off; I updated my page and still receive the same fatal error.
Updated call:
[!UserPlaceholders?!]
[!eForm? &formid=`feedbackForm` &to=`[email protected]` &tpl=`requestForm` &report=`eFeedbackReport` &thankyou=`eFeedbackThanks` &vericode=`0` &subject=`Appointment Request` &eFormOnBeforeFormParse=`eformpopulate`!]
[!eFormPopulate!]
I twitch because I care....and drink too much coffee.
Has anyone had any luck using profile data from a web user in a form snippet? There has to be a solution out there if anyone can point me in the right direction.
I twitch because I care....and drink too much coffee.
-
☆ A M B ☆
- 24,524 Posts
The eFormPopulate snippet has to be called before the eForm snippet call so that the function is available.
The parameter for eForm has to match exactly the name of the function in the eFormPopulate snippet.
Thanks for getting back to me.
So I found out what’s wrong. In the original post:
http://modxcms.com/forums/index.php/topic,22072.msg173340.html#msg173340
I realized that there was a character code (don’t know the technical term for it) instead of a space:
Once I removed that I was able to get the form to appear but nothing to appear in the input field. Am I correct that I use this syntax for placeholders in eForm? [+user.fullname+]
Again thank you for getting back to me.
I twitch because I care....and drink too much coffee.
-
☆ A M B ☆
- 24,524 Posts
Ok so I still cannot see why the values of my form fields are not being populated.
Here’s my form chunk:
<div class="request">
<h2>Use the form below to request an appointment</h2>
<div id="wlpeNewUserInfo">
[+validationmessage+]
</div>
<form method="post" action="[~[*id*]~]">
<fieldset>
<input type="hidden" name="formid" value="feedbackForm" />
<label accesskey="n" for="fullname">Your Name ([+user.fullname+])
<input type="text" name="fullname" maxlength="60" value="[+user.fullname+]" eform="Your Name::1:Expected at least two words:#REGEX /^\w+\s\w+/i" /></label>
<label for="dname">Dogs Name
<input type="text" name="dname" maxlength="60" eform="Dogs Name::1:Please enter your dogs name" value="[+user.dname+]" /></label>
<label accesskey="e" for="email">
Your Email Address
<input type="text" name="email" size="40" maxlength="40" value="[+user.email+]" eform="Your Email Address:email:1" /></label>
<label accesskey="a" for="street">Your Street Address
<input type="text" name="street" size="40" maxlength="40" value="[+street+]" /></label>
<label accesskey="s" for="time">Preferred Time<br />
<select name="time">
<option value="AM">AM</option>
<option value="2">PM</option>
</select></label>
<label accesskey="d" for="date">Preferred Date<br />
[[dateList?]]
</label>
<label accesskey="c" for="comments">Comments<br />
<textarea cols="40" rows="10" name="comments" eform="Comments:html:1">[+user.street+]</textarea>
</label>
<input type="submit" name="submit" value="Send Feedback">
</fieldset>
</form>
</div>
And here’s my call:
[!UserPlaceholders!]
[!eFormPopulate!]
[!eForm? &formid=`feedbackForm` &to=`[email protected]` &tpl=`requestForm` &report=`eFeedbackReport` &thankyou=`eFeedbackThanks` &vericode=`0` &subject=`Appointment Request` &eFormOnBeforeFormParse=`eformpopulate`!]
I can get the place holders to appear out of the form but not in the input fields. Do my input field names have to match what’s in the snippet code? For example if I want to put [+user.fullname+] in the Name field do I need to call it ’fullname’?
I twitch because I care....and drink too much coffee.
Wiggy -
Do you only use one TV per form? If I wanted to use multiple for say, email and fullname; where would I put the Snippet Call for UserPlaceholders? I tried two and it threw an error. eForm is clearing my value attributes; late, late last night I vaguely remember reading another post about this happening, I’ll try and see if that user was able to fix it.
One thing I’m doing is still trying to use validation. Can you do that if you add a value to your eForm? Thanks for your help.
I twitch because I care....and drink too much coffee.