Make fmbadhandler repopulate name and email fields | Simple How-to
Make fmbadhandler repopulate name and email fields*
When the return link is clicked on the error page, the following entries and changes in the HTML form will make fmbadhandler repopulate the name and email fields of the form, as it now repopulates the message field only:
1. Add the line below to the HTML form, as is:
<input type="hidden" name="derive_fields" value="email=Email,realname=Name" />
(EDIT:The unnecessary reference has been edited out of the above line according to Russel's input in the next post, and the code works perfectly.)
2. Add the line below to the HTML form, as is, to prevent receiving emails with its content appearing twice:
<input type="hidden" name="mail_options" value="exclude=email;realname" />
3. Find the following line in the HTML form, and replace the word realname with Name, as shown:
<input type="text" name="Name" />
4. Find the following line in the HTML form, and replace the word email with Email, as shown:
<input type="text" name="Email" />
The content of the emails you'll receive will appear as follows:
Name: Name of sender
Email: eMail address of sender
mesg: Sender's message.
* Although I got this to work perfectly, I really can't write code; I simply followed directions from the links listed below.
If those of you who can write code see how this code should be changed and/or improved, please post the changes? :)
http://www.tectite.com/fmdoc/creating_forms.php
http://www.tectite.com/vbforums/show...realname+email
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Hi,
Thanks for your simple HOW-TO....I'll copy it to the HOW TO forum.
Regarding:
Quote:
(I added imgverify as without it for some reason it lost its required status)
I can't see how that would happen. The "required" or "conditions" fields in your form are untouched by FMBadHandler.
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Thanks for this information! I ran into this issue recently and your HOWTO worked perfectly! :) Peace...
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Thanks for letting me know it was useful to you. :)
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Hi:
The line below, do you have to do this with all the fields you want to repopulate when the user returns to the form?
<input type="hidden" name="derive_fields" value="email=Email,realname=Name" />
I am not using realname. I am using firstname, lastname, email, email2 (to verify email), phone, message.
The same thing with this line:
<input type="hidden" name="mail_options" value="exclude=email;realname" />
do i exclude all my fields that I mentioned above?
Thanks for your help.
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
I tried playing with the code, and do I put the code in my contactus.html form, or my template for fmbadhandler? When I hit my retun_link there is nothing repopulated in the fields, and my exclude email still sends the email and realname.
Thanks
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
The code is put in your form, not a template.
Quote:
The line below, do you have to do this with all the fields you want to repopulate when the user returns to the form?
<input type="hidden" name="derive_fields" value="email=Email,realname=Name" />
No, just those 2 "special fields".
Quote:
I am not using realname. I am using firstname, lastname, email, email2 (to verify email), phone, message.
If you're not using realname, then you don't need to derive that field. The firstname and lastname fields should automatically be filled in when you return to the form. You will need to derive the email field, renaming your field "Email" instead of "email", then exclude it from being listed twice by using the exclude statement in your mail_settings tag:
HTML Code:
<input type="hidden" name="mail_options" value="exclude=email" />
Quote:
do i exclude all my fields that I mentioned above?
No, you only exclude the fields that you've renamed (derived), so that they're not listed twice in the email you receive. email and realname are special fields that are expected by the script. That's why those 2 field names are automatically listed in the email that the recipient gets.
If your form isn't refilling the form fields when using fmbadhandler, then you probably don't have $TARGET_URLS specified, or you didn't specify the url for "this_form" in that hidden field.
If you read the pages on Advanced Error Handling and "Derive Fields" in the Tectite documentation, you'll have a better grasp of what you need to do.
ginger
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Hi,
I found this thread to be very helpful.
Just one thing the line;
Code:
<input type="hidden" name="mail_options" value="exclude=email;realname" />
For me this needs to be;
Code:
<input type="hidden" name="mail_options" value="Exclude=email;realname" />
Capitol E in Exclude or else I recieve an error and the fields still appear on the submitted email.
I'm not the person to say why I just found this makes it work for me.
Cheers.
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Firstly, thanks for making such a superlative product available; the level of support for FormMail and the scope for customisation far exceed any other free form mailers I have looked at.
I am however left a little puzzled by this issue. I understand that 'realname' and 'email' are treated as 'special values' by the PHP scripts (although I am uncertain why this is so); but not why they get 'lost' when the user is returned to the form. Rather than requiring the proposed work-around, which I did try but threw up one or two quirks, is there no scope for modifying the PHP of fmbadhandler to pass them back in a similar fashion to other values?
Re: Make fmbadhandler repopulate name and email fields | Simple How-to
Quote:
Originally Posted by
NorthPole
I understand that 'realname' and 'email' are treated as 'special values' by the PHP scripts (although I am uncertain why this is so);
realname and email are special fields that are used by the script for the "header" of the email.
Quote:
Originally Posted by
NorthPole
Rather than requiring the proposed work-around, which I did try but threw up one or two quirks
I've not seen any quirks that you refer to. What exactly is happening?
ginger