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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:20:36+00:00 2026-05-15T19:20:36+00:00

I am using a JavaScript to dynamically output a specific default text to the

  • 0

I am using a JavaScript to dynamically output a specific default text to the additional comments box in Bugzilla, based on the bug status which is selected from the drop down menu. I have tried using ‘bug.bug_status’ but this only changes on the submission of the page. The variable I have found which populates the drop down menu is ‘bug_status.name’ but when I try use this variable, it does not seem to be recognised. Has anyone any suggestions what may be causing the problem? Has anyone tried this before?

The following code has been placed at the start of the knob.html.tmpl file.

[% PROCESS global/variables.none.tmpl %]
[% # Output a specific default content in the comments box depending on bug status. %]
<script type="text/javascript">
<!--
var messages = ['Message 0', 'Message 1', 'Message 2', 'Message 3', 'Message 4',    'Message 5', 'Message 6'];
function changetext(selectObj){
   var textAreaElement = document.getElementsByName("comment")[0];
[% IF (bug_status.name == "ASSIGNED") %]
   textAreaElement.value = messages[4];
[% ELSIF(bug_status.name == "RESOLVED") %]
   textAreaElement.value = messages[5];
[% ELSE %]
   var variable1 = 0;
   variable1 = bug_status.name
   textAreaElement.value = variable1;
[% END %]
  • 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-15T19:20:37+00:00Added an answer on May 15, 2026 at 7:20 pm

    Based on your other question, it seems that you want this to change on the client side as the user is selecting a new status. However, the code that you have written in this question will change on the server side before the client sees it. Your if/else tree needs to be written in javascript instead of in Template Toolkit.

    So, something like this:

    function changetext(selectObj){
      var textAreaElement = document.getElementsByName("comment")[0];
      var currentStatus = document.getElementById("bug_status").value;
    
      if (currentStatus == "ASSIGNED") {
        textAreaElement.value = messages[4];
      } else if (currentStatus == "RESOLVED") {
        textAreaElement.value = messages[5];
      } else {
        textAreaElement.value = currentStatus;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using JavaScript to dynamically add and animate text in a specific group in SVG,
I have a working JavaScript code below which dynamically creates JSON object using JSON.parse
I'm trying to add a text field to a form dynamically using javascript. From
i created some text boxes dynamically using javascript, now i want to access them
I'm using JavaScript to dynamically generate a dialogue box (it's a div element), containing
I'm using javascript to dynamically create a button where I set all the attributes
Can we create a WEB GRID dynamically using JAVASCRIPT ? I am using MVC
How can I dynamically name id's using javascript? Something like this: js: var idName
I need to dynamically build a list of textboxes using javascript and jquery. The
I am using an JavaScript (and AJAX) to dynamically load a PHP page into

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.