Hi, If I use this code and fill up the TEXTAREA in IE and then click on the SAVE button, the TEXTAREA still has the OLD values (not updated).
Alternatively if after the TEXTAREA is updated via the wbt script, I then pause the script with a MESSAGE prompt, add and a remove a space manually to the textarea and then let the program continue, the page is updated and the textarea now has the new values.
Any Ideas how I can get the update to stick without the manual intervention. Please help
Thanks
PinDescActual = "This is a test"
TextCollection = msie.document.GetElementsByTagName("TEXTAREA")
ForEach TxtArea In TextCollection
TxtAreaId = strtrim(TxtArea.getAttribute("id"))
if strtrim(TxtArea.getAttribute("id")) != "DescriptionField" then Continue
TxtArea.style.border = ".25mm solid red"
TxtArea.value = PinDescActual
Message(App, "Modify the Text Area by adding/removing a space. This click continue")
Break
next
objEvent = msie.document.createEvent("HTMLEvents") ; needed for compatability mode
ButtonCollection = msie.document.GetElementsByTagName("Button")
ForEach Button In ButtonCollection
;ButtonClass = strtrim(button.getAttribute("class"))
if strtrim(button.getAttribute("class")) != "RCK Hsu mix Vxj aZc GmH adn Il7 Jrn hNT iyn BG7 gn8 L4E kVc" then Continue
Button.style.border = ".25mm solid red"
If objEvent == "" Then ; needed for compatability mode
button.click
Else
objEvent.initEvent("click", @true, @true)
button.dispatchEvent(objEvent)
Timedelay(2)
EndIf
Break
Next
exit
Your problem may be the result of a caching or synchronization issues but I have no idea how to tell or how to go about correcting it based on the given information. You might want to consider searching the Tech Database for ideas.
Maybe try Timedelay(2) or TxtArea.innerHTML=PinDescActual
Assuming I am remembering correctly, which is always a questionable thing, it is a "feature" but I can't find the documentation to explain it. For the change to take place something must happen with the form field such as a TAB or leave the field or some such thing...can't remember exactly but you have demonstrated it by the pause and manual change. Also can't remember what I did to resolve the problem. I would go with Stan's suggestion and try innerHTML. Will post again if I remember what I did.
Jim
TxtArea.innerHTML did the trick !!!!
I was tearing my hair out all this time :)
Thanks Stan.
It always seems so obvious when somebody else thinks of it...
I believe it requires a "change" event to be triggered which the "value" update doesn't do. I didn't try that before but something I just ran across in looking for some documentation to explain the problem made me wonder if that could be done using the createEvent and dispatchEvent methods. Will play around and see.
Jim
Now I am curious because it works fine for me using your code against an HTML and WebBatch file.
Jim