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 votes

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
Community showcase
Published Aug 21, 2018 in Agile

What's new this quarter in Confluence Server - August 2018

Hello Atlassian Community! My name is Ada , and I'm the Product Marketing Manager for Confluence Server at Atlassian. If you missed   our last post, we're transitioning to quarterly updates&nb...

154 views 0 1
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