For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2004 > Re: [PEAR] QF checkbox set value (easy, I hope!)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] QF checkbox set value (easy, I hope!)
Ian P. Christian

2004-06-07, 3:59 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 07 June 2004 16:03, Tom Melendez wrote:

> I'd rather have it give me back a 'Y' instead of a 1. Is this possible?


When you process the form, just have something like

$checkboxValue = $form->exportValue('checkbox')?'Y':'N';

Ian P. Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAxIy/Ee6ncNCcEO0RAvArAKCwnQ4334yeB0hoY2mfnQJ/K8/UQACfRI1l
7qMifB1zMlPafyU4FsCco5s=
=hkuk
-----END PGP SIGNATURE-----
Tom Melendez

2004-06-07, 3:59 pm

Hi Ian,

Thanks for the quick response! Yes, I can certainly do that, but does
this mean that I CAN'T change the value via addElement?

Thanks,

Tom

On Mon, 2004-06-07 at 11:41, Ian P. Christian wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Monday 07 June 2004 16:03, Tom Melendez wrote:
>
>
> When you process the form, just have something like
>
> $checkboxValue = $form->exportValue('checkbox')?'Y':'N';
>
> Ian P. Christian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
>
> iD8DBQFAxIy/Ee6ncNCcEO0RAvArAKCwnQ4334yeB0hoY2mfnQJ/K8/UQACfRI1l
> 7qMifB1zMlPafyU4FsCco5s=
> =hkuk
> -----END PGP SIGNATURE-----

--
====
========================
Tom Melendez
Senior Software Developer
BASCOM Global Internet Services, Inc.
Phone : 631-434-6600
Fax : 631-434-7800
Email : tmelendez@bascom.com
Web : http://www.bascom.com
========================

Ian P. Christian

2004-06-07, 3:59 pm

=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 07 June 2004 17:06, Tom Melendez wrote:
> Hi Ian,
>
> Thanks for the quick response! Yes, I can certainly do that, but does
> this mean that I CAN'T change the value via addElement?


AFAIK, you can't change the way it behaves. There is an advanced checkbox=
=20
that might have features I am unaware of, have you looked at this?

=2D --=20
Ian P. Christian
- pookey@pookey.co.uk
- http://www.pookey.co.uk/
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAxJYVEe6ncNCcEO0RAhtRAKC+H2iiZF95
yJD0scOzK+oy4g7gkwCg8zyS
vcoPj6BRnllPwVCeLNCIJ04=3D
=3DSQvs
=2D----END PGP SIGNATURE-----
Bertrand Mansion

2004-06-07, 3:59 pm

Tom Melendez wrote:

>Hey everyone,
>
>I hope this is an easy one for you folks:
>
>How can I change the value of a checkbox? I use this code:
>
>$form->addElement('checkbox', 'mycheck2','My
>check','chcklabel',array('value'=3D>'xxxxx'));
>
>and in the tag, the value still comes out as 1. Now, I understand that
>a checkbox is a True/False type thing (if its set, then it is true), but
>I'd rather have it give me back a 'Y' instead of a 1. Is this possible?


You can have a look at the advcheckbox element.
Although I never had the need to use it myself, I think it does what you wa=
nt.

Bertrand Mansion
Mamasam
Tom Melendez

2004-06-07, 3:59 pm

I think you are right. Ok, I'll give it a shot.

Thanks,

Tom

On Mon, 2004-06-07 at 14:50, Bertrand Mansion wrote:
> Tom Melendez wrote:
>
>
> You can have a look at the advcheckbox element.
> Although I never had the need to use it myself, I think it does what you want.
>
> Bertrand Mansion
> Mamasam



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com