A long time ago I used MailChimp (free account) options to create a Signup Form:
https://www.publictalksoftware.co.uk/newsletter-signup/
The problem is that:
The user can hit Subscribe without selecting any of the newsletter categories.
This makes their signing up pointless.
Does any one know how to improve the MailChimp signup form to force the user to check a field to select atleast 1 option?
This is the current HTML for the section of interest:
<div class="mc-field-group input-group">
<strong>Which Theocratic Software Are You Interested In? </strong>
<ul><li>
<input type="checkbox" value="1" name="group[20257][1]" id="mce-group[20257]-20257-0">
<label for="mce-group[20257]-20257-0">Meeting Schedule Assistant</label>
</li>
<li>
<input type="checkbox" value="2" name="group[20257][2]" id="mce-group[20257]-20257-1">
<label for="mce-group[20257]-20257-1">Public Talks</label>
</li>
<li>
<input type="checkbox" value="4" name="group[20257][4]" id="mce-group[20257]-20257-2">
<label for="mce-group[20257]-20257-2">Visits Rota</label>
</li>
<li>
<input type="checkbox" value="8" name="group[20257][8]" id="mce-group[20257]-20257-3">
<label for="mce-group[20257]-20257-3">Cross Platform (iOS / macOS / Android)</label>
</li>
<li>
<input type="checkbox" value="16" name="group[20257][16]" id="mce-group[20257]-20257-4">
<label for="mce-group[20257]-20257-4">Other Software</label>
</li>
</ul>
<span id="mce-group[20257]-HELPERTEXT" class="helper_text">Please select atleast one </span>
</div>
I notice that the other input fields have the required parameter specified and in this case the logic is a list iof input fields, so it inself none can have the required property set else all will need to be ticked.
But surely there was be a way to custom validate and check all these fields to make sure atleast one is ticked, and tell the user?
Related
I am developing this form that has the functionality that allow the user to add an input field in the form. Here's the input field that will be added:
<li>
<input type="text" name="appliSkill[]" placeholder="Adobe Photoshop" >
</li>
I am using contact form 7 plugin to handle the the submission and email process of this for.
For a simple input name, we can easily call the [input-name] in the mail section of the cf7 to pass the value of that field and send it through email.
I would like to do the same and get all the value of appliSkill[] and pass it to the email. Assuming the form would be look like this after the user add more fields:
<ul>
<li>
<input type="text" name="appliSkill[]" placeholder="Adobe Photoshop" >
</li>
<li>
<input type="text" name="appliSkill[]" placeholder="Adobe Photoshop" >
</li>
<li>
<input type="text" name="appliSkill[]" placeholder="Adobe Photoshop" >
</li>
<li>
<input type="text" name="appliSkill[]" placeholder="Adobe Photoshop" >
</li>
</ul>
How can i do that?
Thank you in advance :)
I have one page checkout in magento for a site and while choosing and option "Ship to this address" it remains on same tab rather than moving to the shipping method tab. How do I solve this problem, is this error occurred in java script or in code? Can anyone help me?
Here is the details in which i have edited for onepage for adding services in the onepage checkout:
i Have edited the /app/design/frontend/base/default/template/checkout/onepage/shipping.phtml as
<li class="fields">
<div class="field">
<label for="servicepack">Services:</label>
<div class="input-box">
<input type="radio" value="3" name="sevicepack" style="width:13px;"> Priority Service</input><br /><input type="radio" value="4" name="sevicepack" style="width:13px;"> Road Express Service</input>
</div>
</li>
addedd this field and also edited /app/design/frontend/default/theme495/template/persistent/checkout/onepage/billing.phtml
<li class="fields">
<div class="field">
<label for="servicepack">Services:</label>
<div class="input-box">
<input type="radio" value="3" name="sevicepack" style="width:13px;"> Priority Service</input><br /><input type="radio" value="4" name="sevicepack" style="width:13px;"> Road Express Service</input>
</div>
</li>
If your running on magento 1.8
try this.
go to /app/design/frontend/base/default/template/checkout/onepage/ file payment.phtml
open it, line 36
<fieldset>
<?php echo $this->getChildHtml('methods') ?>
</fieldset>
add id to fieldset
<fieldset id="checkout-payment-method-load">
<?php echo $this->getChildHtml('methods') ?>
</fieldset>
I have a table in html which lists review entries then scores them using a drop down box. I am wondering how to count the results:
<td class="views-field views-field-field-price-editable" >
<div class="views-row-edit-static"></div><div class="views-row-edit-edit"><div class="field-type-list-text field-name-field-price field-widget-options-buttons form-wrapper" id="edit-node-59200313-field-price"><div class="form-item form-type-radios form-item-node-59200313-field-price-und">
<label for="edit-node-59200313-field-price-und">Price <span class="form-required" title="This field is required.">*</span></label>
<div id="edit-node-59200313-field-price-und" class="form-radios"><div class="form-item form-type-radio form-item-node-59200313-field-price-und">
<input type="radio" id="edit-node-59200313-field-price-und-no-mention" name="node[59200313][field_price][und]" value="no mention" checked="checked" class="form-radio" /> <label class="option" for="edit-node-59200313-field-price-und-no-mention">No Mention </label>
</div>
<div class="form-item form-type-radio form-item-node-59200313-field-price-und">
<input type="radio" id="edit-node-59200313-field-price-und-positive" name="node[59200313][field_price][und]" value="positive" class="form-radio" /> <label class="option" for="edit-node-59200313-field-price-und-positive">Positive </label>
</div>
<div class="form-item form-type-radio form-item-node-59200313-field-price-und">
<input type="radio" id="edit-node-59200313-field-price-und-negative" name="node[59200313][field_price][und]" value="negative" class="form-radio" /> <label class="option" for="edit-node-59200313-field-price-und-negative">Negative </label>
</div>
</div>
</div>
</div></div> </td>
There are 3 options: 1) "No Mention" 2) Positive 3) Negative
In the code, the field 'Service' has been scored 'positive'.
How do I count these values up, so I can see how many 'Positives' there are in my 'Service' column? The website is run on php so I'd assume I can use this but as the fields are not numeric I am not so sure. Any help appreciated.
You have to provide us with more (HTML) code (the part with No Mention and Negative) for us to help you out but you (probably) only need to create a new variable and set it to zero and every time a field has the value Positive you just add one to the variable - but without the HTML and PHP code we cannot really help you more!
Here is the snippet of html code.....
1)After checking each check box the value's is posting to the database.
2)But the problem is when i checked other, i need to take the value of the text box and it is posting the value of the checkbox instead of the textbox value
but i don't know where i did mistake...
<form action="purchase.php" name="form1" id="form1" method="POST">
<ul class="n_ul"> <span>*</span>
What is your Primary goal?
<br>
<br>
<li>
<input name="goal" id="goal" value="Add a popular customer service to attract/retain more customers"
type="checkbox">
</li> <span>*</span>
Popular customer Services
<br>
<br>
<li>
<input name="goal" id="goal" value="Add a turnkey revenue sources for my location(s)"
type="checkbox">
</li> <span>*</span>
trunkey revenue source
<br>
<br>
<li>
<input name="goal" id="goal" type="checkbox" value="other">
</li> <span>*</span>
Other (Please specify below)
<br>
<br>
<input name="other" id="goal" type="text" class="new">
</ul>
<input type="submit" name=submit value="submit">
</form>
Any suggestions are acceptable....
Try something like
$_POST['goal'] = ($_POST['goal']=='other') ? $_POST['other'] : $_POST['goal'];
This will overwrite the value of goal with the value of other only when the 'other' radio is ticked
Also id attributes of html elements should be unique on the page
EDIT
Your question is a little vague. It seems like you may want the form to submit when a checkbox button is clicked.
If this is the case the other field will be unlikely to be filled as the form will often be submitted before the user gets to populate it
Try adding a button or input to submit the form
Like this
<button type="submit">Submit</button>
You can check the value of your checkbox, and if it equals to other, you can grab your value from textbox. Do it following way:
if (isset($_POST['goal']) && $_POST['goal'] == 'other')
{
// do something with $_POST['other']
}
Try this
<form action="" name="form1" id="form1" method="POST">
<ul class="n_ul"> <span>*</span>
What is your Primary goal?
<br>
<br>
<li>
<input name="goal[]" id="goal" value="Add a popular customer service to attract/retain more customers"
type="checkbox">
</li> <span>*</span>
Popular customer Services
<br>
<br>
<li>
<input name="goal[]" id="goal" value="Add a turnkey revenue sources for my location(s)"
type="checkbox">
</li> <span>*</span>
trunkey revenue source
<br>
<br>
<li>
<input name="goal[]" id="goal" type="checkbox" value="other">
</li> <span>*</span>
Other (Please specify below)
<br>
<br>
<input name="other" id="goal" type="text" class="new">
</ul>
<input type="submit" name=submit value="submit">
</form>
<?php
$other="";
$goal=$_REQUEST['goal'];
if(in_array("other", $goal)){
$other=$_REQUEST['other'];
}
echo $other;
?>
I have set up a PHP form for a competition for users to enter all information to be stored in a database. I used a NetTut+ tutorial to do so.
I've got the form submitting to the database as required, but with so many additional questions being asked, I would like to split the form into two separate sections. Obviously the first page would say continue to the next step before the second step allowing for the form to be submitted to the database.
The content that the user sees should be split, but should all be a part of the same form. Step 1 > Step 2 before submission.
Would anyone know of or recommend any methods to do this?
I've attached the code below.
<form method="post" action="">
<fieldset>
<ul>
<li>
<label for="code">Entry Code On-Pack</label>
<input type="text" name="code" />
</li>
<li>
<label for="name">Name</label>
<input type="text" name="name" />
</li>
<li>
<label for="email">Email</label>
<input type="text" name="email" />
</li>
<li>
<label for="addressone">Address</label>
<input type="text" name="addressone" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addresstwo" />
</li>
<li>
<label for="addressone"> </label>
<input type="text" name="addressthree" />
</li>
<li>
<label for="telephone">Telephone</label>
<input type="text" name="telephone" />
</li>
<li>
<label for="dob">Date of Birth</label>
<input name="dob" type="text" value="[dd/mm/yy]" />
</li>
<li>
<label for="q1">Where have you seen Cookstown advertised?</label><br />
<input type="checkbox" name="q1cb1" /><label for="q1cb1">Magazines</label><br />
<input type="checkbox" name="q1cb2" /><label for="q1cb2">Billboards</label><br />
<input type="checkbox" name="q1cb3" /><label for="q1cb3">Television</label><br />
<input type="checkbox" name="q1cb4" /><label for="q1cb4">Radio</label><br />
<input type="checkbox" name="q1cb5" /><label for="q1cb5">Online</label><br />
<input type="checkbox" name="q1cb6" /><label for="q1cb6">Public Transport</label><br />
<input type="checkbox" name="q1cb7" /><label for="q1cb7">Bus Stops</label><br />
</li>
<li>
<label for="q2">How well do you remember those advertisments?</label><br />
<input type="radio" name="q2" value="VeryWell"/><label for="q1cb1">Very well</label><br />
<input type="radio" name="q2" value="FairlyWell"/><label for="q1cb2">Fairly well</label><br />
<input type="radio" name="q2" value="FewDetails"/><label for="q1cb3">A few details</label><br />
<input type="radio" name="q2" value="NotAtAll"/><label for="q1cb4">Not at all</label><br />
</li>
<label for="tc">Do you accept the terms and conditions</label>
<input type="checkbox" name="tc" class="styled" />
</li>
<li> </li>
<li>
<input type="submit" value="Enter Competition" class="large blue button" name="signup" />
</li>
</ul>
</fieldset>
</form>
Use sessions mechanism to store 1 step data
You could pass them to page two and then put them in as hidden variables. You could also use session variables.
example with hidden fields
Sessions are usually the preferred way to do this, but hidden form fields would work just as well.
It's pretty easy to do - after the first submission, store the values into the session - validate them first if you like, it's probably a good idea to do so in fact. Then go to the next page, and once submitted, validate the second bunch of answers and put them into the database.
Hidden form fields work too, but I prefer the session-based approach.
Good luck!
One other option would be to put the additional fields in a hidden div on the same page and use javascript to show them once the first set have been completed. The advantage for you is that it keeps your form processing simpler. Also for your users, they won't have a round trip to the server to get the other part of the form.
This, of course, requires that your users have javascript turned on. The best practice would be to show all fields on the same page by default, and then use JS to hide the second batch before the page renders.