PEAR::HTML_QuickForm select element

This is a discussion on PEAR::HTML_QuickForm select element within the PHP Language forums, part of the PHP Programming Forums category; Marcin Dobrucki <Marcin.Dobrucki@TAKETHISAWAY.nokia.com> pipotte et a dit : > I am trying to get a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-09-2004
Julien CROUZET aka c2c
 
Posts: n/a
Default Re: PEAR::HTML_QuickForm select element

Marcin Dobrucki <Marcin.Dobrucki@TAKETHISAWAY.nokia.com> pipotte et a dit :

> I am trying to get a default value set for a "Select" element, like this:
>
> $f = new HTML_QuickForm("request", "post", "", "_self", NULL,TRUE);
> $f_priority = array ("Very low","Low","Normal","High","Very High");
> $priority_element =& $f->addElement("select", "request_priority",
> "Priority:", $f_priority);
> $priority_element->setSelected("2");
> ...
>
> But the html which is generated from this looks like this:
>
> ...
> <option value="1">Low</option>
> <option value="2" selected="selected">Normal</option>
> <option value="3">High</option
> ...
>
> To my understanding, it should only say "selected", not "selected="selected"
>
> Is there some workaround, am I doing something wrong, or does one need
> to hack QuickForm for this?
>


The valid XHTML syntax is <option selected="selected"

http://www.w3schools.com/xhtml/xhtml_syntax.asp

--
Julien CROUZET aka c2c Promo 2007
>> Suivi: Une operation de maintenance va necessiter d'interrompre gate-nat
>> Suivi: momentanement. Duree de l'operatin evaluee a 15 minutes.

> Suivi: Intervention terminee. Duree reelle de l'intervention: 30 minutes.

badi
Reply With Quote
  #2 (permalink)  
Old 06-09-2004
Marcin Dobrucki
 
Posts: n/a
Default PEAR::HTML_QuickForm select element

I am trying to get a default value set for a "Select" element, like this:

$f = new HTML_QuickForm("request", "post", "", "_self", NULL,TRUE);
$f_priority = array ("Very low","Low","Normal","High","Very High");
$priority_element =& $f->addElement("select", "request_priority",
"Priority:", $f_priority);
$priority_element->setSelected("2");
....

But the html which is generated from this looks like this:

....
<option value="1">Low</option>
<option value="2" selected="selected">Normal</option>
<option value="3">High</option
....

To my understanding, it should only say "selected", not "selected="selected"

Is there some workaround, am I doing something wrong, or does one need
to hack QuickForm for this?

/Marcin
Reply With Quote
  #3 (permalink)  
Old 06-09-2004
Marcin Dobrucki
 
Posts: n/a
Default Re: PEAR::HTML_QuickForm select element

Julien CROUZET aka c2c wrote:

>
> The valid XHTML syntax is <option selected="selected"
>
> http://www.w3schools.com/xhtml/xhtml_syntax.asp


Buggers, Mozilla 1.6 doesn't render it then. :/

/Marcin
Reply With Quote
  #4 (permalink)  
Old 06-09-2004
Alvaro G Vicario
 
Posts: n/a
Default Re: PEAR::HTML_QuickForm select element

*** Marcin Dobrucki wrote/escribió (Wed, 09 Jun 2004 08:52:40 GMT):
> Buggers, Mozilla 1.6 doesn't render it then. :/


It does render it!

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Reply With Quote
  #5 (permalink)  
Old 06-09-2004
Marcin Dobrucki
 
Posts: n/a
Default Re: PEAR::HTML_QuickForm select element

Alvaro G Vicario wrote:
> *** Marcin Dobrucki wrote/escribió (Wed, 09 Jun 2004 08:52:40 GMT):
>
>> Buggers, Mozilla 1.6 doesn't render it then. :/

>
> It does render it!


no it doesn't. In the example I posted, the rendered default
selected option is "very low" when it should be "normal".

/Marcin
Reply With Quote
  #6 (permalink)  
Old 06-09-2004
Marcin Dobrucki
 
Posts: n/a
Default Re: PEAR::HTML_QuickForm select element

Alvaro G Vicario wrote:
> *** Marcin Dobrucki wrote/escribió (Wed, 09 Jun 2004 08:52:40 GMT):
>
>> Buggers, Mozilla 1.6 doesn't render it then. :/

>
> It does render it!


Indeed. My browser was stuck in nevernever land, and after it reset
it seems to have worked.

/Marcin
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:31 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0