velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Townson, Chris" <>
Subject Velocimacro problem evaluating variable value
Date Mon, 11 Jul 2005 11:11:30 GMT
Hi - 

In my VM_global_library, I have the following simple macro to create a
drop-down list of name titles for HTML forms:

 * makeTitlesDropDown
 * Macro to create a select + options drop-down list of name titles
 * Does not include a label for the select box, because we might want this
 * Takes three parameters:
 *   var STRING $id: value of the id for the select box
 *   var STRING $name: value of the name attribute for the select box
 *   var STRING $selected: the name title value to be set as pre-selected
#macro ( makeTitlesDropDown $id $name $selected )
<select id="$id" name="$name">
    <option value="Dr"#if($selected = "Dr")
    <option value="Prof"#if($selected = "Prof")
    <option value="Mr"#if($selected = "Mr")
    <option value="Mrs"#if($selected = "Mrs")
    <option value="Miss"#if($selected = "Miss")
    <option value="Ms"#if($selected = "Ms")

I then call this with the following:
#makeTitlesDropDown ( "title" "title" "Mr" )

The select list comes out fine, except for the fact that the third parameter
- which is used to pre-select a particular option - is not being picked up /
evaluated as expected.

Is there anything really obvious that I am doing wrong here?? :D



DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and 
attachments (if any). No contracts may be concluded on behalf of Macmillan 
Publishers Limited or its agents by means of e-mail communication. Macmillan 
Publishers Limited Registered in England and Wales with registered number 785998 
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message