Re: <LIST> TAG default value in ver 3.2.2

Gabriele Morelli <[email protected]> Wed, 26 Jan 2005 09:02:42 +0000 (UTC)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
Joel Palmius <joel.palmius <at> miun.se> writes:

> 
> On Tue, 25 Jan 2005, Gabriele Morelli wrote:
> 
> > Unfortunately my LIST tag is composed by LISTELEMENT(s) that already have 
set
> > the VALUE attribute. Example :
> >        <LIST NAME="provdf" CAPTION="Provincia:" STYLE="element1"
> > VISIBLELEN="1">
> > CONCATENATION
> > <LISTELEMENT VALUE="" CAPTION=" " />
> > <LISTELEMENT VALUE="AG" CAPTION="AGRIGENTO" />
> > <LISTELEMENT VALUE="AL" CAPTION="ALESSANDRIA" />
> > <LISTELEMENT VALUE="AN" CAPTION="ANCONA" />
> > ...
> > and so on...
> >
> > As you can see i added a blank LISTELEMENT on the top...Is there a way I can
> > workaround in another way?
> > If there's no other way its not a big problem...
> > but I am a perfectionist )
> 
> Some browsers also autoselect one element in the list, and some even 
> pre-checks radio buttons if all are clear, so it will never be perfect. 
> However, this problem is obviously a bug, so it should be fixed.
> 
> I'll take a look at it, but if you are keen on perl programming and want 
> to give it a try, the relevant procedure is in Survey/Component/List.pm, 
> in a sub called PrintComponent().

HI,
I opened the file List.pm and I have seen this snippet of code that bugant 
developed:

    #bugant persist ;)
    if ($chkpersist == $doc->GetListElementParam($tagno,$i,"VALUE"))
    {
	$outr .=  " selected=\"selected\"";
    }
    else
    {
	if($doc->GetListElementParam($tagno,$i,"SELECTED") eq "yes")
	{
	    $outr .=  " selected=\"selected\"";
	}
    }

I've checked the HTML output on the page when the my mod_survey is running and 
it seems to write "selected" to every LISTELEMENT on the LIST tag:

        <select class="LISTsel" name="provdf" size="1">
          <option selected="selected" value=" "> </option>
          <option selected="selected" value="AG">AGRIGENTO</option>

          <option selected="selected" value="AL">ALESSANDRIA</option>
          <option selected="selected" value="AN">ANCONA</option>
          <option selected="selected" value="AO">AOSTA</option>

It seems that the if statement I copied above always put "selected" to every 
item.I am not really keen on PERL but I think this is where the bug is.

Gabriele

> 
>    // Joel
> 
> > Gabriele
> >
> >
> >
> > Skickat av Gabriele Morelli <morelli <at> istitutodeglinnocenti.it>
> > till survey-discussion
> >
> Skickat av Joel Palmius <joel.palmius <at> miun.se>
> till survey-discussion
> 
> 




Skickat av Gabriele Morelli <[email protected]>
till survey-discussion