jeudi 25 août 2016

Add "All" option in dropdown menu

I have a code that I slapped together a few months ago to create a dropdown menu for a website that populates information based on year. Today, I received a request to add in an "all" feature for it that would show all the information being filtered, but I can't seem to figure out how to do so. Here's what I have now:

<select name="year" onChange="myform.submit();">

    <CFIF IsDefined ("year")> <option value="<CFOUTPUT>#Year#</CFOUTPUT>" selected><CFOUTPUT>#Year#</CFOUTPUT></option>  </CFIF>


    <option value="<CFOUTPUT>#CurrentYear#</CFOUTPUT>"><CFOUTPUT>#CurrentYear#</CFOUTPUT></option>
    <option value="<CFOUTPUT>#CurrentYear-1#</CFOUTPUT>"><CFOUTPUT>#CurrentYear-1#</CFOUTPUT></option>
    <option value="<CFOUTPUT>#CurrentYear-2#</CFOUTPUT>"><CFOUTPUT>#CurrentYear-2#</CFOUTPUT></option>
    <option value="<CFOUTPUT>#CurrentYear-3#</CFOUTPUT>"><CFOUTPUT>#CurrentYear-3#</CFOUTPUT></option>
    <option value="<CFOUTPUT>#CurrentYear-4#</CFOUTPUT>"><CFOUTPUT>#CurrentYear-4#</CFOUTPUT></option>  
    <option value="<CFOUTPUT>#CurrentYear-5#</CFOUTPUT>"><CFOUTPUT>#CurrentYear-5#</CFOUTPUT></option>
</select>

                        <CFIF IsDefined ("year")>
                        <CFIF IsDefined ("year")><CFSET year =#form.year#></CFIF>
                        <CFELSE>
                            <CFSET year =2016>  
                        </CFIF>

Can anyone help me out with this?

Aucun commentaire:

Enregistrer un commentaire