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 6200769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:25:43+00:00 2026-05-24T04:25:43+00:00

I am using .tmpl() to fill out templates like so <script type=text/x-jquery-tmpl id=template> <form

  • 0

I am using .tmpl() to fill out templates like so

<script type="text/x-jquery-tmpl" id="template">
  <form action="" method="post">
    <div>
      <div> ${ID} </div>
      <div> <input name="title" id="${ID}_title" value="${title}" type="text" /> </div>
      <label> Section (${section}) </label> &nbsp;
      <select name="section" id="${ID}_section">
        <option value="">-- Select --</option>
        <option value="aaa">AAA</option>
        <option value="bbb">BBB</option>
      </select>
    </div>
  </form>
</script>

where ${section} wil contain either the combo box value aaa or bbb.

How do I set the default selection for the combo box according to ${section}?

  • 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-24T04:25:44+00:00Added an answer on May 24, 2026 at 4:25 am

    try something like:

    <select name="section" id="${ID}_section">
        <option value="">-- Select --</option>
        <option value="aaa" {{if $section == 'aaa'}} selected="selected" {{/if}}>AAA</option>
        <option value="bbb" {{if $section == 'bbb'}} selected="selected" {{/if}}>BBB</option>
    </select>  
    

    Update
    Well my jsfiddle in comment was just a way to simulate your setup, because you don’t attached it in this post. If $section == bbb or aaa try this:

     <select name="section" id="${ID}_section">
        <option value="">-- Select --</option>
        <option value="aaa" {{if section == 'aaa'}} selected="selected" {{/if}}>AAA</option>
        <option value="bbb" {{if section == 'bbb'}} selected="selected" {{/if}}>BBB</option>
    </select>
    

    Otherwise more code is needed, how do you call your template and how is $section assigned.

    Update 2
    try: http://jsfiddle.net/3TrEY/6/

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

Sidebar

Related Questions

I am using the jquery-tmpl template library to build a dynamic <select> list. In
I'm using jQueryUI and jQuery-tmpl, but I believe the advice I'm looking for is
I'm using the jQuery.validate() plugin for a form. However the form contains a fieldset
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I would like to use the HTML::Template module. However, it is not installed on
I am using a JavaScript to dynamically output a specific default text to the
I have a question concerning using the toggle function. I have a template that
I am using the micro template ( Micro Template ) in my project. Below

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.