Dynamically change the Textfield value in Velocity template?

Hi,

I have tried the following code to change the text field value dynamically,

Java Code:

public String getTimeValue() {

return timeValue;

}

public void setTimeValue(String timeValue) {

this.timeValue = timeValue;

}

Velocity source:

<script type = "text/javascript">

function changeField() {

document.getElementById("field").value= $timeValue;

}

</script>

<body>

<td>TimeCriteria:

<input type="text" id="field" value = "" name="timeCriteria" onChange="changeField()"> </td>

</body>

But I am Unable to get the result in the textfield , Will any body check this source please and suggest me any modification required in the code.

Thanks in Advance.

1 answer

This widget could not be displayed.

What do you mean by "unable to get result"? Where is your code placed? Where is it supposed to run? Does if do anything at all?

Actually I need to get the Java String Variable value into velocity file and need to input that value to the Text field.

I'm afraid that doesn't clarify any of the questions I've got. Could you tell us what the answers to my specific questions are please?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Aug 06, 2018 in Agile

Boosting team's visibility with ScriptRunner like a boss

Just like almost every team here we are struggling with visibility both internal and external each day. I want to share a short story about how we have improved the internal part by a great deal and ...

346 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you