Author Topic: IE form does not get saved  (Read 132 times)

hdsouza

  • Full Member
  • ***
  • Posts: 152
IE form does not get saved
« on: July 14, 2019, 10:44:48 am »
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

Code: Winbatch
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

 

td

  • Tech Support
  • *****
  • Posts: 3014
    • WinBatch
Re: IE form does not get saved
« Reply #1 on: July 15, 2019, 09:45:46 am »
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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

stanl

  • Pundit
  • *****
  • Posts: 934
Re: IE form does not get saved
« Reply #2 on: July 16, 2019, 02:47:19 am »
Maybe try Timedelay(2) or TxtArea.innerHTML=PinDescActual

JTaylor

  • Pundit
  • *****
  • Posts: 1013
    • Data & Stuff Inc.
Re: IE form does not get saved
« Reply #3 on: July 16, 2019, 08:33:15 am »
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

hdsouza

  • Full Member
  • ***
  • Posts: 152
Re: IE form does not get saved
« Reply #4 on: July 16, 2019, 08:57:00 am »
TxtArea.innerHTML did the trick !!!!
I was tearing my hair out all this time :)
Thanks Stan.

td

  • Tech Support
  • *****
  • Posts: 3014
    • WinBatch
Re: IE form does not get saved
« Reply #5 on: July 16, 2019, 01:22:13 pm »
It always seems so obvious when somebody else thinks of it...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

  • Pundit
  • *****
  • Posts: 1013
    • Data & Stuff Inc.
Re: IE form does not get saved
« Reply #6 on: July 16, 2019, 05:19:35 pm »
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

JTaylor

  • Pundit
  • *****
  • Posts: 1013
    • Data & Stuff Inc.
Re: IE form does not get saved
« Reply #7 on: July 16, 2019, 06:10:11 pm »
Now I am curious because it works fine for me using your code against an HTML and WebBatch file.

Jim