Results 1 to 1 of 1

Thread: Multiple checkboxes

  1. #1
    Thread Starter
    Veteran vienna's Avatar
    Join Date
    May 2010
    Location
    Vienna, Austria
    Posts
    718
    Thanks
    19
    Thanked 177 Times in 118 Posts

    Multiple checkboxes

    I am refreshing my request for MULTIPLE CHECKBOXES in the Form Builder.

    I have included a sample of some nonsense but to show 3 different multiple value checkboxes.

    I was able to build them in the Classipress Field and Form builder after extensive modifications. But they allow me to make a FIELD that holds a string of separate values separated by commas--exactly the way the Dropdown List Field option works....EXCEPT that my Checkbox option then outputs checkboxes for each option value in the Ad form. And it allows for selecting every option or value that is appropriate for the ad. What is saved when the Ad is submitted is a string array separated by commas.

    In the ad itself in theme-functions I built a function that pulls out just the checkboxes and displays them in a list such as:

    Days of Availability

    • Monday
    • Wednesday
    • Thursday


    House Amenities


    • Gardener
    • Gated security
    • Olympic sized swimming pool
    • Garage parking

    The Ad owner can edit the ad after it is created at any time and either add or subtract from the complete checkbox options offered and Update the Ad.

    If the User does NOT SELECT or UNCHECKS every checkbox in a particular multi-value checkbox, such as "HOUSE AMENITIES" then on the Public website when that ad is viewed that list of values and its title will not be output at all so the page is clean and has no "ghosts" of values not checked.

    I know little about PHP...I have to research, research...and fail a thousand times for each function success, before I get my intended results.

    If I can do this as a neophyte then it is "child's play" for the Developers David and Seth and whoever else is working on this. And because I could Modify Classipress to give me as many multi-value checkboxes as I need for each Category form it means I can also go back and use the same methods to create Radio Buttons--which I don't need right now.

    So, here is hoping that the Developers will EXPAND the FIELD TYPES into the valuable CHECKBOX and RADIO BUTTON functionality.

    I am sure they will come up something more elegant than my mod, but, my modifications give me exactly the functionality I wanted a couple of months ago from Classipress.

    I am hoping that the next edition has some real functionality added to expand the types of websites that can be built with ClassiPress. The Custom Forms and Custom Fields are the KEY to that expanded functionality and more paying clients.

    In the output code below I had to use good old tables, which are STILL SUPERIOR to CSS for some issues. In my case CSS was not sufficient to get Checkboxes to line up visually with precision alongside their Labels or Values....this example does not have the accompanying CSS that augments it but here it is.....


    HTML Code:
    <div id="checkboxes"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <th colspan="2" scope="col">Available Days</th>
      </tr> 
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value="Sunday" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >Sunday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Monday" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Monday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Tuesday" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Tuesday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Wednesday" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Wednesday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Thursday" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Thursday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Friday" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Friday</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_days[]" class="checkbox" id="" value=" Saturday" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Saturday</td>
      </tr>    
      </tr>
    </table></div><div class="clr"></div>	
    		<div id="checkboxes"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <th colspan="2" scope="col">Staff Provided</th>
      </tr> 
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_house[]" class="checkbox" id="" value="Cook" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >Cook</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_house[]" class="checkbox" id="" value=" Housekeeper / Maid" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Housekeeper / Maid</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_house[]" class="checkbox" id="" value=" Gardener" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Gardener</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_house[]" class="checkbox" id="" value=" Watchman" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Watchman</td>
      </tr>    
      </tr>
    </table></div><div class="clr"></div>	
    		<div id="checkboxes"><table width="100%" border="0" cellspacing="0" cellpadding="5">
      <tr>
        <th colspan="2" scope="col">Suitability</th>
      </tr> 
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_suitability[]" class="checkbox" id="" value="Pet Friendly: Small dogs allowed with an additional pet deposit" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >Pet Friendly: Small dogs allowed with an additional pet deposit</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_suitability[]" class="checkbox" id="" value=" Not Suitable for Children: Children 12 and older are allowed" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" > Not Suitable for Children: Children 12 and older are allowed</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_suitability[]" class="checkbox" id="" value="Smoking Allowed" checked="yes"/></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >Smoking Allowed</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_suitability[]" class="checkbox" id="" value="Smoking Allowed: Outdoor areas only" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >Smoking Allowed: Outdoor areas only</td>
      </tr>    
     
                  
                  <tr>
        <td width="4%"><input style="display:inline-block; float:left;" type="checkbox" name="cp_checkbox_suitability[]" class="checkbox" id="" value="No smoking at all" /></td>
        <td width="96%"style="vertical-align:top; text-indent: 7px; text-align: left;" >No smoking at all</td>
      </tr>    
      </tr>
    </table></div><div class="clr"></div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Saving multiple checkboxes output as Array
    By vienna in forum ClassiPress General Discussion
    Replies: 0
    Last Post: July 16th, 2010, 12:06 PM
  2. Multiple domains
    By tad3776 in forum ClassiPress General Discussion
    Replies: 2
    Last Post: July 11th, 2010, 09:50 AM