Problems with Checkboxes in Membership Edit Profile Form

8 posts by 4 authors in: Forums > CMS Builder
Last Post: April 1, 2015   (RSS)

By MatrixHyperLoop - March 18, 2015

Hi guys,

I am up against a wall... I'm trying to add a field called show_contact that when clicked on an edit account page will change the values of show_contact.

Here is my code for form input field

<input type="checkbox" name="show_contact" value="<?php echo htmlencode(@$_REQUEST['show_contact']); ?>"/>

I also added the field in the _post call

$colsToValues['show_contact']         = $_REQUEST['show_contact'];

When I check the box and save nothing happens on the backside and i get the following error.

MySQL Error: Incorrect integer value: '' for column 'show_contact' at row 1

Please help me! Thanks so much!

CR

By MatrixHyperLoop - March 19, 2015

Thanks got this to work! Now I am having conflicts with twitter-bootstrap with the way they handle checkboxes....

http://getbootstrap.com/css/#forms

Instead of just a checked status they rewrite the html to having a span around the input.

Checked looks like this

<span class="checked">

<input checkbox>

</span>

Unchecked is the same without the span. I am also having trouble passing the values from the checkbox with the way bootstrap handles checkboxes. Anyone had to work around this before?

By Damon - March 20, 2015

I checked out the Bootstrap link, checked the checkbox and viewed the page source to see this:

<div class="checkbox">
  <label>
    <input type="checkbox"> Check me out
  </label>
</div>

What version of Bootstrap are you using?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Damon - March 20, 2015

I checked out the Bootstrap link, checked the checkbox and viewed the page source to see this:

<div class="checkbox">
  <label>
    <input type="checkbox"> Check me out
  </label>
</div>

What version of Bootstrap are you using?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By MatrixHyperLoop - March 20, 2015

im using bootstrap 3.

By Damon - March 31, 2015

Sorry for the delay in getting back to you. I was hoping someone with more experience with Bootstrap would add some ideas.

Can you start by getting the form to display results (checked box) outside without using Bootstrap?

Could you send in a support request so I can see what is currently happening and review the code?
https://www.interactivetools.com/support/email_support_form.php?priority=free

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By gregThomas - April 1, 2015

Hi,

I often use bootstrap in my projects, and have found that you can use the standard checked="checked" attribute in checkbox tags to load the checkbox as checked. Here is an example from a recent project:

                <div class="checkbox">
                  <label>
                    <input type="hidden" name="covered_by_insurance" value="0" />
                    <input name="covered_by_insurance" value="1" <?php checkedIf(@$_REQUEST['covered_by_insurance'], '1'); ?> type="checkbox"> Is this item covered by insurance? (Should it be included in insurance calculations)?
                  </label>
                </div>

The checkedIf function is built into CMS builder, and will echo checked="checked" if the two variables passed into it are the same.

Cheers,

Greg

Greg Thomas

PHP Programmer - interactivetools.com