1
torrent
Two questions?
  • 2006/6/4 15:29

  • torrent

  • Just popping in

  • Posts: 7

  • Since: 2006/5/25


Hey guys,

Thanks for the help before but I have some more questions :P

How can I change this code so that the default filled in radio button is yes instead of no?:

$reg_form->addElement(new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $user_mailok));

And is there a hack for the downloads module so that I don't have to put in file sizes in bytes, and put them in megabytes instead since I upload large files?

Thanks

2
xuser
Re: Two questions?
  • 2006/6/4 16:02

  • xuser

  • Just popping in

  • Posts: 73

  • Since: 2002/11/26


1 the source of XoopsFormRadioYN

Quote:

class XoopsFormRadioYN extends XoopsFormRadio
{
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param string $value Pre-selected value, can be "0" (No) or "1" (Yes)
* @param string $yes String for "Yes"
* @param string $no String for "No"
*/
function XoopsFormRadioYN($caption, $name, $value=null, $yes=_YES, $no=_NO, $id="")
{
$this->XoopsFormRadio($caption, $name, $value, $id);
$this->addOption(1, $yes);
$this->addOption(0, $no);
}
}
Xuser's site
http://xuser.org
http://theme.xoops.org.cn

3
torrent
Re: Two questions?
  • 2006/6/4 16:48

  • torrent

  • Just popping in

  • Posts: 7

  • Since: 2006/5/25


Hey,

Thanks for the reply.

I changed the code to this:

class XoopsFormRadioYN extends XoopsFormRadio
{
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param string $value Pre-selected value, can be "0" (No) or "1" (Yes)
* @param string $yes String for "Yes"
* @param string $no String for "No"
*/
function XoopsFormRadioYN($caption, $name, $value=1, $yes=_YES, $no=_NO)
{
$this->XoopsFormRadio($caption, $name, $value);
$this->addOption(1, $yes);
$this->addOption(0, $no);
}
}
?>

Is this right? Because I uploaded the file and it still defaults to no in the register.php

Thanks

4
OldFriend
Re: Two questions?
  • 2006/6/4 18:56

  • OldFriend

  • Just popping in

  • Posts: 99

  • Since: 2005/10/28


$reg_form->addElement(new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $user_mailok));

The third parameter is the default.

So if you set $user_mailok to 1 before you execute the class statement it should default to yes.

5
torrent
Re: Two questions?
  • 2006/6/4 19:51

  • torrent

  • Just popping in

  • Posts: 7

  • Since: 2006/5/25


Do I change this:

$user_mailok = (isset($_POST['user_mailok']) && intval($_POST['user_mailok'])) ? 1 : 0;

to this?

$user_mailok = 1;

Is that the line I change?

Thanks

Login

Who's Online

203 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 203


more...

Donat-O-Meter

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

Latest GitHub Commits