Strange select code

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange select code

Jolle Carlestam-2
My select lists look like this when they arrive to the web page:

<select  name="timeperiod" id="form2_timeperiod4" onchange="makedirty
()">
<option value="">V&auml;lj tidsperiod</option>
<option value=""></option>
<optgroup label="Tidsperioder">
<option value="">V&auml;lj tidsperiod</option>
<option value="10000 fkr - 1000 ekr">10000 fkr - 1000 ekr</option>
<option value="1000 - 1300-talen">1000 - 1300-talen</option>
<option value="1400 - 1500-talen">1400 - 1500-talen</option>
<option value="1600 - 1700-talen">1600 - 1700-talen</option>
<option value="1800 - 1900-talet">1800 - 1900-talet</option>
<option value="1900 - 2000-talet">1900 - 2000-talet</option>
</optgroup>
</select>

Notice the two <option value="">V&auml;lj tidsperiod</option> and the  
empty option before the optgroup. What did I do wrong?

Here's the code that I suppose is the culprit:

cfg_fact_edit.inc:
        var: 'timeperiods'=array;

/.../

        $f -> (addfield:
                        -type='select',
                        -name='timeperiod',
                        -dbfield='FH_FCT_timeperiod',
                        -label='Tidsperiod',
                        -options=$timeperiods,
                        -required,
                        -default='Välj tidsperiod');

lib_fact_edit.inc:
$timeperiods = (array: -optgroup='Tidsperioder',''='Välj tidsperiod',  
'10000 fkr - 1000 ekr',
        '1000 - 1300-talen',
        '1400 - 1500-talen',
        '1600 - 1700-talen',
        '1800 - 1900-talet',
        '1900 - 2000-talet'
        );

HDB
Jolle


#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lists.montania.se/Lists/knop/
(log in with your email and ConfirmationID as password, send message to
<[hidden email]> to get that ID)
Project homepage http://montania.se/projects/knop/
AIM chatroom knop aim:gochat?roomname=knop


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange select code

Johan Solve-2
At 11.40 +0200 2007-05-29, Jolle Carlestam wrote:

>Notice the two <option value="">V&auml;lj tidsperiod</option> and the empty option before the optgroup. What did I do wrong?


> $f -> (addfield:
> -type='select',
> -name='timeperiod',
> -dbfield='FH_FCT_timeperiod',
> -label='Tidsperiod',
> -options=$timeperiods,
> -required,
> -default='Välj tidsperiod');


Nothing wrong, just the expected.
-default shows up as an extra option first in the select, with blank value. This is what shows up on a page where the select has no initial value.
To make it look nicer it is separated from the rest of the options by a blank option.

That's just a way to do it that I've become used to, so I implemented that in Knop...

Remove -default and you'll get rid of both your troubles.
--
     Johan Sölve    [FSA Member, Lasso Partner]
     Web Application/Lasso/FileMaker Developer
     MONTANIA SOFTWARE & SOLUTIONS
http://www.montania.se   mailto:[hidden email]
 (spam-safe email address, replace '-' with 'a')

#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lists.montania.se/Lists/knop/
(log in with your email and ConfirmationID as password, send message to
<[hidden email]> to get that ID)
Project homepage http://montania.se/projects/knop/
AIM chatroom knop aim:gochat?roomname=knop

Loading...