Copy large text value with javascript
I'm messing around with setting up a button on a page to copy the value of a hidden page item (that's getting it's value set from a page computation) to a textarea item - using javascript.
My javascript function is as follows:
function setItem(pSourceItem, pDestItem){
if (document.getElementById(pSourceItem).value != "")
document.getElementById(pDestItem).value = document.getElementById(pSourceItem).value;
}
And I call it from the button as follows:
javascript:setItem('P899_SRC','P899_DEST')
The javascript function is in a custom library that I've loaded and properly referenced in the page where I'm trying to run this opertion. I don't get any errors about the function not existing or anything like that.
However, the value never gets copied from the source to the destination. Obviously I'm doing something wrong and I just can't see what it is. Can anyone see anything wrong here??
Odd thing is I've used this very function to set text field items and it worked just fine. Doesn't seem to like the textarea item for some reason.
Earl