1

My process:

  1. First I designed a signup form for my website using Bootstrap
  2. Then, I created a signup form using MailChimp, so I can track and contact my signups
  3. I then generated the embed form HTML markup, and combined the two

The issue:

The part that is breaking the form is that the Bootstrap radio button toggle uses input type="button" and the MailChimp form I am trying to map it to uses type="radio".

If I don't use type="radio", the submission works but when I check the information on my subscribers in MailChimp, I am missing data from that part of the form on.

If I use type="radio", the form prematurely submits when the user tries to use the toggle button, so basically the form submits before they can finish filling out the rest of the form.

JSFiddle Demo of the issue is here: http://jsfiddle.net/halsey/qwPzy/9/

The solution?

I am aware of threads like this, which say you will need to override this behavior with javascript, but I can't find an example of how to do this.

I'm sure this is embarrassingly easy but I am having trouble locating resources to help me learn how to fix this. Thanks in advance for any help you can provide.

Footnote

StackOverflow is preventing me from linking to JSFiddle without embedding code. I would encourage you to use the link above, but my broken attempt at embedding the code is below. Apologies for the weird formatting but I am having trouble embedding the code in one chunk - I am a StackOverflow beginner.

HTML:

<form action="http://foorder.us6.list-manage1.com/subscribe/post?u=81c3da3b3ebbf564cf50a78ff&amp;id=f16451f556" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

                            <fieldset class="mc-field-group">


                                <div class="form-field input-prepend">

                                        <span class="add-on">http://Foorder.com/</span>

                                        <input class="span3 required" id="prependedInput mce-MMERGE2" type="text" placeholder="YourProfile" value="" name="MMERGE2">

                                 </div><!-- / .formfield .input-prepend -->


                                <div class="form-field">


                                       <input type="email" class="span3 required email" placeholder="Email" value="" name="EMAIL" id="mce-EMAIL">



                                    <input type="text" class="span2 required" placeholder="Zip Code" value="" name="MMERGE8" id="mce-MMERGE8">

                                </div><!-- / .formfield -->

                                <div class="form-field">



                                      I want to&nbsp;&nbsp;
                                        <div class="btn-group" data-toggle="buttons-radio">
                                             <button type="radio" class="btn" value="Buy" name="MMERGE3" id="mce-MMERGE3-0">Buy</button>
                                             <button type="radio" class="btn" value="Sell" name="MMERGE3" id="mce-MMERGE3-1">Sell</button>
                                        </div>
                                      &nbsp;&nbsp;items on Foorder

                                </div><!-- / .formfield -->

                                <div class="form-field">

                                        <button type="button" class="btn btn-link" data-toggle="collapse" data-target="#promo-code-toggle">

                                            Have a promo code?

                                         </button>


                                        <div id="promo-code-toggle" class="collapse">

                                                   <input type="text" class="span2" placeholder="Promo Code" value="" name="MMERGE1 promocodeinput" id="mce-MMERGE1 promo-code-input">


                                        </div><!-- / .formfield -->




                                </div><!-- / .formfield -->


                                 <div id="mce-responses" class="clear">

                                        <div class="response" id="mce-error-response" style="display:none"></div>

                                        <div class="response" id="mce-success-response" style="display:none"></div>

                                </div>  


                                <div class="form-field">


                                    <button type="submit" class="button btn btn-primary" value="Subscribe" name="subscribe" id="mc-embedded-subscribe">Submit</button>

                                </div><!-- / .formfield -->


                            </fieldset>

                       </form>

CSS HEAD links:

<link href="http://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link href="http://foorder.com/_Resources/SBX/css/bootstrap.css" rel="stylesheet">
<link href="http://foorder.com/_Resources/SBX/css/bootstrap-responsive.css" rel="stylesheet">

Javascript BODY links:

<script src="http://foorder.com/_Resources/SBX/js/jquery.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-transition.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-alert.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-modal.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-dropdown.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-scrollspy.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-tab.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-tooltip.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-popover.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-button.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-collapse.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-carousel.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-typeahead.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/bootstrap-affix.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/holder/holder.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/google-code-prettify/prettify.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/application.js"></script>
<script src="http://foorder.com/_Resources/SBX/js/custom.js"></script>
Community
  • 1
  • 1
Halsey
  • 11
  • 2

2 Answers2

1

Have you tried putting an "onsubmit" on the form and running thru a function to determine testing?

ala

<form action="http://foorder.us6.list-manage1.com/subscribe/post?u=81c3da3b3ebbf564cf50a78ff&amp;
    id=f16451f556" method="post" id="mc-embedded-subscribe-form" 
    name="mc-embedded-subscribe-form" class="validate" target="_blank" 
    onsubmit="return checkValidity(this);">

and in your js code:

function checkValidity(form){
  if(){
       // return false <-- doesn't submit
      }
  }
S. Albano
  • 707
  • 7
  • 21
james emanon
  • 11,185
  • 11
  • 56
  • 97
  • Thanks for your help. I tried to upvote but apparently I don't have enough of a reputation around here :) – Halsey Mar 02 '13 at 04:59
  • oh no worries. If you use this solution, don't hesitate to 'accept' the answer. Click the check image. But no worries, glad to help. – james emanon Mar 02 '13 at 07:52
0

So this JSFiddle that I found on the Bootstrap Github worked for me: http://jsfiddle.net/charettes/SauLj/

HTML:

<div class="btn-group">
<input type="radio" name="radios" id="radio_1" />
<label class="btn" for="radio_1">Radio one</label>
<input type="radio" name="radios" id="radio_2" />
<label class="btn" for="radio_2">Radio two</label>
<input type="radio" name="radios" id="radio_3" />
<label class="btn" for="radio_3">Disabled radio three</label>

CSS:

    .btn-group > input {
    display: none;
}

.btn-group input:first-child + .btn {
     /* This is an actual copy/paste of the .btn-group .btn:first-child style */
    border-bottom-left-radius: 4px;
    border-top-left-radius: 4px;
    margin-left: 0;
}

input:checked + label.btn {
    /* This is an actual copy/paste of the .btn:active style */
    background-color: #E6E6E6;
    background-image: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.5);
    outline: 0 none;
}

input[disabled] + label.btn {
    /* This is an actual copy/paste of the .btn:disabled style */
    background-color: #E6E6E6;
    background-image: none;
    box-shadow: none;
    cursor: default;
    opacity: 0.65;
}
Halsey
  • 11
  • 2