1
legueux
Re: Checkbox in form
  • 2006/5/22 12:53

  • legueux

  • Just popping in

  • Posts: 2

  • Since: 2006/5/20


Well, I tried during week-end to fin a solution.

Actually, this is the only way that I find to specified wich option is use :

$equip_tray = new XoopsFormElementTray(_MD_CATADS_EQUIP);
    
$abs = new XoopsFormCheckBox("""abs", !$abs[$i++]);
    
$abs->addOption("1","ABS");
    
$equip_tray->addElement($abs);
    unset(
$abs);

    
$esp = new XoopsFormCheckBox("""esp", !$esp[$i++]);
    
$esp->addOption("1","ESP");
    
$equip_tray->addElement($esp);
    unset(
$esp);

    
$vitreselect = new XoopsFormCheckBox("""vitreselect", !$vitreselect[$i++]);
    
$vitreselect->addOption("1","Vitr.Elec");
    
$equip_tray->addElement($vitreselect);
    unset(
$vitreselect);

    
$verrcentral = new XoopsFormCheckBox("""verrcentral", !$verrcentral[$i++]);
    
$verrcentral->addOption("1","Verr.Central");
    
$equip_tray->addElement($verrcentral);
    unset(
$verrcentral);

    
$clim = new XoopsFormCheckBox("""clim", !$clim[$i++]);
    
$clim->addOption("1","Climatisation");
    
$equip_tray->addElement($clim);
    unset(
$clim);

    
$teleco = new XoopsFormCheckBox("""teleco", !$teleco[$i++]);
    
$teleco->addOption("1","Teleco");
    
$equip_tray->addElement($teleco);
    unset(
$teleco);

    
$mainlibre = new XoopsFormCheckBox("""mainlibre", !$mainlibre[$i++]);
    
$mainlibre->addOption("1","Main.Libre");
    
$equip_tray->addElement($mainlibre);
    unset(
$mainlibre);

    
$odb = new XoopsFormCheckBox("""odb", !$odb[$i++]);
    
$odb->addOption("1","ODB");
    
$equip_tray->addElement($odb);
    unset(
$odb);

    
$peintmetal = new XoopsFormCheckBox("""peintmetal", !$peintmetal[$i++]);
    
$peintmetal->addOption("1","Peint.Metal");
    
$equip_tray->addElement($peintmetal);
    unset(
$peintmetal);

    
$radiocd = new XoopsFormCheckBox("""radiocd", !$radiocd[$i++]);
    
$radiocd->addOption("1","RadioCD");
    
$equip_tray->addElement($radiocd);
    unset(
$radiocd);

    
$radiocass = new XoopsFormCheckBox("""radiocass", !$radiocass[$i++]);
    
$radiocass->addOption("1","RadioCass");
    
$equip_tray->addElement($radiocass);
    unset(
$radiocass);

    
$toit = new XoopsFormCheckBox("""toit", !$toit[$i++]);
    
$toit->addOption("1","T.O");
    
$equip_tray->addElement($toit);
    unset(
$toit);

    
$regvit = new XoopsFormCheckBox("""regvit", !$regvit[$i++]);
    
$regvit->addOption("1","Reg.Vitesse");
    
$equip_tray->addElement($regvit);
    unset(
$regvit);

    
$cuir = new XoopsFormCheckBox("""cuir", !$cuir[$i++]);
    
$cuir->addOption("1","Cuir");
    
$equip_tray->addElement($cuir);
    unset(
$cuir);

    
$jantalu = new XoopsFormCheckBox("""jantalu", !$jantalu[$i++]);
    
$jantalu->addOption("1","Jante.Alu");
    
$equip_tray->addElement($jantalu);
    unset(
$jantalu);

    
$boitoto = new XoopsFormCheckBox("""boitoto", !$boitoto[$i++]);
    
$boitoto->addOption("1","Boite.Auto");
    
$equip_tray->addElement($boitoto);
    unset(
$boitoto);

    
$gps = new XoopsFormCheckBox("","gps", !$gps[$i++]);
    
$gps->addOption("1","GPS");
    
$equip_tray->AddElement($gps);
    unset(
$gps);

    
$adsform->addElement($equip_trayfalse);


With this, all Checkbox are already checked in form and to not display one of this option in result I must uncheck that I don't want to display.

I've tried to change the number "1" by "0" in each $xxx->addOption("1","xxx"); . With this change all Chackbox are effectively uncheck but when I check one or more nothing is display in result.

The other prob (and whatever if in form the checkbox are check/uncheck by default) I can't change the status when I use the edition.

I've readed all posts (with search engine) about checkbox but I didn't find what's wrong with my php code.

Thank you for your help.



2
legueux
Checkbox in form
  • 2006/5/20 15:36

  • legueux

  • Just popping in

  • Posts: 2

  • Since: 2006/5/20


Hi,

I'm actually make a website under XOOPS and I've got a prob with Catads module and more more particulary with the form of this module.

I want to modify this form to add checkbox like this :

Resized Image

I've declared all the vars and create this in MySQL tab like this :

CREATE TABLE `xoops_catads_ads` (
  `
ads_idint(11NOT NULL auto_increment,
  `
cat_idint(11NOT NULL default '0',
  `
ads_titlevarchar(100NOT NULL default '',
  `
ads_typevarchar(40NOT NULL default '',
  `
ads_desctext NOT NULL,
  `
priceint(11NOT NULL default '0',
  `
price2int(11NOT NULL default '0',
  `
anneeint(11NOT NULL default '0',
  `
monnaievarchar(20NOT NULL default '',
  `
price_optionvarchar(40NOT NULL default '',
  `
emailvarchar(100NOT NULL default '',
  `
uidint(6NOT NULL default '0',
  `
phonevarchar(20NOT NULL default '',
  `
townvarchar(200NOT NULL default '',
  `
codpostvarchar(25NOT NULL default '',
  `
createdint(10NOT NULL default '0',
  `
publishedint(10NOT NULL default '0',
  `
expiredint(10NOT NULL default '0',
  `
viewtinyint(2NOT NULL default '0',
  `
notify_pubtinyint(1NOT NULL default '0',
  `
poster_ipvarchar(20NOT NULL default '',
  `
contact_modetinyint(1NOT NULL default '0',
  `
countpubtinyint(1NOT NULL default '0',
  `
suspendtinyint(1NOT NULL default '0',
  `
waitingtinyint(1NOT NULL default '0',
  `
photo0varchar(255NOT NULL default '',
  `
photo1varchar(255NOT NULL default '',
  `
photo2varchar(255NOT NULL default '',
  `
photo3varchar(255NOT NULL default '',
  `
photo4varchar(255NOT NULL default '',
  `
photo5varchar(255NOT NULL default '',
  `
gpsint(1NOT NULL default '0',
  `
climint(2NOT NULL default '0',
  `
absint(1NOT NULL default '0',
  `
espint(1NOT NULL default '0',
  `
vitreselecint(1NOT NULL default '0',
  `
verrcentralint(1NOT NULL default '0',
  `
telecoint(1NOT NULL default '0',
  `
mainlibreint(1NOT NULL default '0',
  `
odbint(1NOT NULL default '0',
  `
peintmetalint(1NOT NULL default '0',
  `
radiocdint(1NOT NULL default '0',
  `
radiocassint(1NOT NULL default '0',
  `
toitint(1NOT NULL default '0',
  `
regvitint(1NOT NULL default '0',
  `
cuirint(1NOT NULL default '0',
  `
jantaluint(1NOT NULL default '0',
  `
boitotoint(1NOT NULL default '0',
  
PRIMARY KEY  (`ads_id`),
  
KEY `price2` (`price2`)
TYPE=MyISAM AUTO_INCREMENT=30 ;


The prob is that only the first checkbox (GPS) work. All others checkbox don't (no entry in database).

I think that my code in form is wrong but I don't find how to do.

Checkbox Form code :



$equip_tray = new XoopsFormCheckBox(_MD_CATADS_EQUIP"gps"$gps);
    
$equip_tray->addOption(1'GPS');
    
$equip_tray->addOption(2'Climatisation');
    
$equip_tray->addOption(3'ABS');
    
$equip_tray->addOption(4'ESP');
    
$equip_tray->addOption(5'Vitr.Elec');
    
$equip_tray->addOption(6'Teleco');
    
$equip_tray->addOption(7'Clé Main Libre');
    
$equip_tray->addOption(8'Ord. de bord');
    
$equip_tray->addOption(9'Peint. Metal');
    
$equip_tray->addOption(10'Radio CD');
    
$equip_tray->addOption(11'Radio Cass');
    
$equip_tray->addOption(12'TO');
    
$equip_tray->addOption(13'Reg. Vites');
    
$equip_tray->addOption(14'Cuir');
    
$equip_tray->addOption(15'Jantes Alu');
    
$equip_tray->addOption(16'Boite Auto');
                
$adsform->addElement($equip_tray);


Somebody can help me please ?
Thank you.




TopTop



Login

Who's Online

200 user(s) are online (119 user(s) are browsing Support Forums)


Members: 0


Guests: 200


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits