# currencySelect

## Purpose

Helper tag for creating HTML selects for selecting from a list of currency symbols (eg. 'EUR', 'USD' etc.).

## Examples

    <g:currencySelect name="myCurrency" value="${currency}" />

## Description

Attributes

- `from` (optional) - The currency symbols to select from, defaults to the major ones if not specified
- `value` (optional) - The currency value as the currency code. Defaults to the currency for the current Locale if not specified

## Source

Show Source

    def currencySelect = {attrs, body ->
            if (!attrs['from']) {
                attrs['from'] = ['EUR', 'XCD', 'USD', 'XOF', 'NOK', 'AUD', 'XAF', 'NZD', 'MAD', 'DKK', 'GBP', 'CHF', 'XPF', 'ILS', 'ROL', 'TRL']
            }
            try {
                def currency = (attrs['value'] ? attrs['value'] : Currency.getInstance(RCU.getLocale(request)))
                attrs.value = currency.currencyCode
            }
            catch (IllegalArgumentException iae) {
                attrs.value = null
            }
            // invoke generic select
            out << select(attrs)
        }