Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- 
For general guidance and help see http://support.mybuyingbuddy.com/codepen/
UPDATED 9/6/18 - updated the Javascript

INSTRUCTIONS
============
1. Make sure you know the MBB MLS CODE (mls_id) values for each MLS as these will be used in this code
In the example below the two values are "mls-1" and "mls-2".
NOTE: This is the My Buying Buddy "mls_id" field which you can discover from the Widget Wizards.

2. Set the default MLS for your custom form using the the input value shown below
(in this case "mls-1")

3. Add additonal "data-mls" parameter to each option value that is to be used,
and in each case specify the appropriate MLS 

4. Add the jQuery snippet to your page too
-->
<!-- Buying Buddy Plugin for codepen.io -->
<script src='https://maps.googleapis.com/maps/api/js?key=AIzaSyAlDq8fLYmfwIZdmngXCW6Ts80NIlhjwi8'></script>
<script src='https://www.mbb2.com/version3/css/theme/acid/OLrJDh'></script>
<script>
var MBB = { mbbUrl: 'https://www.mbb2.com/version3', seo : 'false' };
MBB.data = { acid : 'OLrJDh', mbbdomain : 'codepen.io' };
</script>
<script src='https://www.mbb2.com/scripts/my-buying-buddy.4.0.js'></script>
<!-- End Buying Buddy Plugin -->

<section id="pen-title">
  <h2>(cs#7) Multiple MLS Search with a Combination Field</h2>
  <p style="color:red">Updated October 2020 to improve accessibility.</p>
  <p>This example shows how an OPTION field can additionaly specificy the MLS to use based on the selected value.<br>In this example, the choice of CITY determines the MLS to search.<br>
    **NOTE This is NOT a working form, it's purpose is to illustrate how this feature is coded.
 <br><small><a href="https://support.mybuyingbuddy.com/codepen/#disclaimer" target="_blank">PLEASE READ DISCLAIMER</a></small></p>
</section>

<!--BEGIN CODE TO COPY -->
<div id="MBBv3Form">
  <div class="bfg-grid-container">
    <div class="custom-form-wrapper clearfix">
      <form id="form-1" class="mbb-lcf-form">
        <!-- ** CHANGE THIS ** Set value to the MLS you want to be default when city is not selected -->
        <input id="multi-mls-mls" name="mls_id" type="hidden" value="mls-1" />        
        <!--End Form Header-->
        
        <!--Container-->
        <div class="bfg-grid-30 bfg-tablet-grid-30 bfg-grid-parent">
          <!--Start Text Box Placeholder-->
          <div class="bfg-grid-100">
            <div class="bfg-input-wrap">
              <div class="bfg-input-item">
                <!-- ** CHANGE THIS ** make these correct city names values and mls_id values  -->
                <select id="multi-mls-city" name="city" class="bfg-input-field" aria-label="City">
                  <option value="" selected="" disabled="">City</option>
                  <option value="arvada" data-mls="mls-1">Arvada</option>
                  <option value="denver" data-mls="mls-1">Denver</option>
                  <option value="louisville" data-mls="mls-2">Louisville</option>
                  <option value="thornton" data-mls="mls-1">Thornton</option>
                  <option value="westminster" data-mls="mls-2">Westminster</option>
                </select>
              </div>
            </div>
          </div>
        </div>
        <!--End container-->
      </form>
    </div>
  </div>
</div>
<!--END CODE TO COPY -->

              
            
!

CSS

              
                /*
Helps reduce spaces between fields for smaller displays
*/
@media (max-width: 1024px) {
  #MBBv3Form .bfg-grid-container [class^="bfg-grid-"]:not(.bfg-grid-parent)   {
    padding-left: 5px;
    padding-right: 5px;
  }
}

/*
This CSS wrapper is optional and provides the translucent background. 
All other CSS comes from the MBB plugin.
*/
#MBBv3Form .custom-form-wrapper {
  padding-top: 20px;
	padding-bottom: 5px;
  border-radius: 2px;
  border-color: #dddddd;
  border-width: 1px;
  border-style: solid;
  background: rgba(255,255,255,0.2);
}

              
            
!

JS

              
                /* 
** This script REQUIRES jQuery **
   If your website does not have jQuery loading then you will to add it.
   There are many hosted libraries available, for example, Google provides such libraries at
   https://developers.google.com/speed/libraries/#jquery

INSTRUCTIONS
============
1. Copy this JavaScript to your website and place in the <head> of the web page. Enclose between <script> tags

2. Make sure that the ID of the "select" matches the elements in the JavaScript below
   In this example <select id="multi-mls-city" ....

*/

jQuery(document).on("mbb-widgets-loaded",function(){
 		mbbQuery("#multi-mls-city").change(function(){
    	var selected = mbbQuery(this).val();
    	if ( selected.length ){ mbbQuery("#multi-mls-mls").val( mbbQuery("option:selected", this).attr("data-mls") ); }
  	});
});
              
            
!
999px

Console