Dynamically change the Textfield value in Velocity template?

Nageswarara Rao October 4, 2013

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

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2013

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?

Nageswarara Rao October 4, 2013

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 5, 2013

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?

TAGS
AUG Leaders

Atlassian Community Events