Custom Forms
The custom forms were created to allow Metrocorp to build any form and have the data saved and be retrievable. Here are the require form elements:
Contents |
[edit] Required Form Elements
<form method=post action="/form_processor/index.php"> <input type="hidden" name="form_name" value="%NAME OF FORM SUBMISSION%"> <input type="hidden" name="redirection" value="%URL OF THE REDIRECT TO THE RESULT PAGE%"> <input type="text" name="Email">
[edit] How to Require Fields
To require fields on your custom forms you'll need to follow these steps:
Step 1
Insert the following code toward the top of your HTML page, preferably inside the <head> tag.
<!-- // Validate // -->
<script src="/scripts/jquery.js" type="text/javascript"></script>
<script src="/scripts/jquery.validate.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$.validator.setDefaults({
//submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
// validate the comment form when it is submitted
$("#commentForm").validate();
});
</script>
<style type="text/css">
label.error { display:block; color:red; }
</style>
<!-- // End: Validate // -->
Step 2
Add the id="commentForm" inside your <form> tag. Like this:
<form method=post action="/form_processor/index.php" id="commentForm">
Step 3
Add class="required" inside each form field you want required. Like this:
<input type="text" name="First Name" value="" size="20" class="required">
If you already have a class defined for your form field your field would look like this:
<input type="text" name="First Name" value="" size="20" class="required otherClassName">
[edit] How to Add an Image Upload Field
In order to add an image upload you must include this in the <form> attribute: enctype="multipart/form-data". This is required to encode the image properly when the form uploads it to the servers. Example:
<form method=post action="/form_processor/index.php" enctype="multipart/form-data">
Then include the image upload field:
<input type="file" name="image" />
The image upload field must have name="image". This is case sensitive.
Note: You can only upload 1 image per form. Call Inetz if you need more than 1 image upload in a form.
[edit] How to Add a File Upload Field
In order to add a file upload you must include this in the <form> attribute: enctype="multipart/form-data". This is required to encode the image properly when the form uploads it to the servers. Example:
<form method=post action="/form_processor/index.php" enctype="multipart/form-data">
Then include the image upload field:
<input type="file" name="file" />
The image upload field must have name="file". This is case sensitive.
Note: You can only upload 1 file per form. Call Inetz if you need more than 1 image upload in a form.
[edit] Automatically Add to a Newsletter
To automatically add an email submitted through a custom form to a newsletter include this hidden field:
<input type="hidden" name="add_to_newsletter" value="6">
The value="6" should be replaced with the database id of the newsletter to which you'd like to add the email. Here is a list of the current newsletters (If the newsletter you're looking for isnt in this list talk to Inetz. This list might be out of date.):
|
Boston Magazine Newsletters |
Philadelphia Magazine |