Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6673979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:41:30+00:00 2026-05-26T03:41:30+00:00

I’ve just started doing some work with Google Closure, and I’d like to move

  • 0

I’ve just started doing some work with Google Closure, and I’d like to move the creation of select fields into its own template, and call into that template with something like:

{call templates.utils.select}
  {param name: 'state'/}
  {param value: $selected_state /}
  {{param options: [
    {name: 'Australian Capital Territory', value: 'ACT'},
    {name: 'New South Wales', value: 'NSW'},
    {name: 'Northern Territory', value: 'NT'},
    {name: 'Queensland', value: 'QLD'},
    {name: 'South Australia', value: 'SA'},
    {name: 'Tasmania', value: 'TAS'},
    {name: 'Victoria', value: 'VIC'},
    {name: 'Western Australia', value: 'WA'}
  ]/}}
{/call}

and the templates.utils.select template would have the logic to set the selected property for the correct option. Unfortunately I get a ‘Not all code is in Soy V2 syntax (found tag {{param options: [ {name: …’ exception.

I assume I could use a work-around of having the options parameter passed into the calling template, but then I’d need to ensure that all the ways of getting into the template are covered, which would get very tedious.

At the moment I think I’ll have to go with

<select name="state">
  <option value="ACT" {if $selected_state=='ACT'}selected="selected"{/if}>Australian Capital Territory'</option>
  <option value="NSW" {if $selected_state='NSW'}selected="selected"{/if}>New South Wales</option>
  ...
</select>

which is also tedious, but at least the data is in a single place.

Is there a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:41:31+00:00Added an answer on May 26, 2026 at 3:41 am

    As of the Sept 19, 2011 release, Closure Templates provides support for list and map literals. Unfortunately, there is a small bug with list and map literals in the release, which is partially fixed in plovr, but an official fix should be coming soon, which will be integrated into plovr once it is available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.