WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • General Community »
  • Global WebsiteBaker 2.8.x discussion »
  • Bug in "form" module (with solution)
  • Print
Pages: [1]   Go Down

Author Topic: Bug in "form" module (with solution)  (Read 6645 times)

Offline Xagone

  • Posts: 482
  • Gender: Male
  • Developper
    • Xagone Inc
Bug in "form" module (with solution)
« on: October 12, 2011, 03:56:38 PM »
simple bug on form module

if you do 2 or more "checkbox" or "radio" with the same choices, the labels will not work properly and you will choose only in the first choices
ex:

choices one:
[] choice1
[] choice2
[] choice3

choices two:
[] choice1
[] choice2
[] choice3

when you click on the choices of "choices two" it'l select the firsts one (because of the labels names and for)

i got a version 2.8.1 wb mod to work, maybe the last version could have this mini mod too in the same way

in the fonction make_checkbox in view.php
Code: [Select]
function make_checkbox(&$n, $idx, $params) {
$field_id = $params[0][0];
$seperator = $params[0][1];
$label_id = 'wb_'.str_replace(" ", "_", $n);
if(in_array($n, $params[1])) {
$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" checked="checked" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</lable>'.$seperator;
} else {
$n = '<input class="field_checkbox" type="checkbox" id="'.$label_id.'" name="field'.$field_id.'['.$idx.']" value="'.$n.'" />'.'<label for="'.$label_id.'" class="checkbox_label">'.$n.'</label>'.$seperator;
}
}
i've changed
Code: [Select]
$label_id = 'wb_'.str_replace(" ", "_", $n);to
Code: [Select]
$label_id = 'wb_'.$field_id.'_'.str_replace(" ", "_", $n);
and i think that for 2.8.2 the line is
Code: [Select]
$label_id = 'wb_'.preg_replace('/[^a-z0-1]/i', '_', $n);and should be change as
Code: [Select]
$label_id = 'wb_''.$field_id.'_'.preg_replace('/[^a-z0-1]/i', '_', $n);
and make_radio have the same problem.
Logged
Xagone Inc. (formerly VotreEspace)
http://xagone.com/

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • General Community »
  • Global WebsiteBaker 2.8.x discussion »
  • Bug in "form" module (with solution)
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2