WordPress.org

Ready to get started?Download WordPress

Forums

Form Manager
how to edit checkbox list to horizontal (5 posts)

  1. jiyuu19th
    Member
    Posted 9 months ago #

    how to edit checkbox list to horizontal like this.

    []xxxx []xxxxxxxx []xxxx
    []xxxxxx []xxxx []xxxxxx

    http://wordpress.org/plugins/wordpress-form-manager/

  2. thatdiegokid
    Member
    Posted 9 months ago #

    In a custom template, I created something like this to deal with exactly that, since I needed my checkboxes grouped in a div.
    Seems like it'd only work if you have one grouping of checkboxes, but it's a start and just built this an hour ago.

    global $wpdb;
    $form_id = fm_form_ID();
    $form_shortcode = preg_replace('/fm-/','',$form_id);
    $elements = $wpdb->get_results( 'SELECT COUNT( ID ) AS count
    FROM wp_fm_items
    WHERE wp_fm_items.ID = (
    SELECT ID
    FROM wp_fm_forms
    WHERE shortcode = "'.$form_shortcode.'" )
    AND wp_fm_items.type = "checkbox"' );
    
    $chck_num = $elements[0]->count;
    
    while(fm_form_have_items()): fm_form_the_item();
    
    if (fm_form_item_type() == 'checkbox'){
    if ($chck_count == 0){ ?>
    <div class="form-group">
    <label class="radio-inline form-wrap__label--bold"> Group Label</label>
    <?php } ?>
    <label class="checkbox-inline" for="<?php echo fm_form_the_nickname();?>">
    <?php echo fm_form_the_input(); ?>
    <?php echo fm_form_the_label(); ?></label>
    <?php
    $chck_count++;
    if ((int)$chck_count == (int)$chck_num ) { echo '</div>'; }
    } else {?>
    <div class="form-group" id="<?php echo fm_form_the_nickname();?>">
    <label for="<?php echo fm_form_the_nickname();?>" class="hide"><?php echo fm_form_the_label(); ?></label>
    <?php echo fm_form_the_input(); ?>
    </div>
    <?php } endwhile; ?>

    Is there a checkbox grouping function that I'm not aware of? Only started digging into this plugin today...

  3. jiyuu19th
    Member
    Posted 9 months ago #

    thank you thatdiegokid. but I still cannot do like that. :cry

  4. thatdiegokid
    Member
    Posted 9 months ago #

    Ah, are you using the list (I just found that, and have been backwards engineering my way through this plugin).

    The separator seems to be hardcoded to a
    tag.
    I had to manually change it in the plugins folder under /types/lists.php the instances of 'separator' => '<br>', to 'separator' => '</li><li>',

    then in
    formelements/formelements.php, inside function fe_getCheckboxListHTML, I changed
    $str = implode($elementDef['separator'],$arr);

    to

    $str = '<ul><li>'.implode($elementDef['separator'],$arr).'</li></ul>';

    to produce a list, that you can then style with CSS!

  5. thatdiegokid
    Member
    Posted 9 months ago #

    I normally wouldn't recommend modifying the plugin like this since any changes will get overwritten with an update, but personally, I needed to get this functionality in now.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.