Is there a way to disable and/or delete the "First Name" and "Last Name" fields in SC Pro? I need to collect only email addresses and zip codes.
Disable required fields (Pro)
(4 posts) (3 voices)-
Posted 2 years ago #
-
simpleContact Pro was designed with an in-built assumption that a user's name and email address would be the minimum information that a website owner would want, for two main reasons:
1) You can't always determine someone's name from an email address. If a user goes by spacemonkey@hotmail.com (or something equally quirky) it makes it harder to reply in a friendly way.
2) If an email address isn't provided, an autoresponder message can't be sent - or any email at any time...
I will review these assumptions over time and consider making them optional fields, but for now your best bet is to pre-fill and hide the name fields (thereby working around the requirement).
------------------------------------
1) Add HTML snippets
Log into sc_admin and navigate to the contact form builder page. Create an HTML snippet and position it before your first name field, with the following code:
<div class="hidden">Next, create another snippet and position it after your last name field:
</div>2) Edit screen.css
Open screen.css
Find the selector for legend and change it to say:
legend, div.hidden {
display: none;
visibility: hidden;
}3) Edit forms.js
Open sc_admin/js/forms.js
Delete line 2 and replace it with these lines:
if ($("#form_contact").is("form")) {
$("#form_contact").submit( function() { return validateContact(); } );
$("#name_first").attr("value","Name");
$("#name_last").attr("value","Not Supplied");
}Form submissions will appear in your inbox with "Name Not Supplied" in the name column.
Please note:
1) This hack will only work where a user has JavaScript turned on.
2) You should remove the name tags from your autoresponder message, to prevent "Name Not Supplied" appearing in the email.
Posted 2 years ago # -
Is there a way to do this just for the email address field? We are not wanting to capture email address as we already have this data.
Posted 7 months ago # -
It should be sufficient to just pre-fill the email field with a value that looks like an email address (to pass the validation) and hide it.
Try putting the HTML snippet described in step 1 around your email field, and replacing the code in step 3 with this:
if ($("#form_contact").is("form")) {
$("#form_contact").submit( function() { return validateContact(); } );
$("#email").attr("value","user@domain.com");
}All the other steps would be the same.
Posted 7 months ago #
Reply
You must log in to post.