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

0 vote

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 Join to answer
Community showcase
Bridget Sauer
Published Wednesday in Agile

Community Showcase: Thomas Deiler, Mountaineering Agile Coach

Thomas Deiler is a Bavarian, Mountaineering, Senior Agile Coach. In this Showcase, you will learn about his journey from software engineer to project manager, his freelance philosophy, and much more....

85 views 2 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot