我怎么能强制AngluarJS形式来实现所需的字段已通过DOM操作(没有用户输入)填补?所需、字段、来实现、形式

2023-09-13 05:21:07 作者:哟西,花姑娘滴

我已经写了一个Excel VBA宏一些数据粘贴到AngularJS形式 - 它会打开一个Internet Explorer(11)窗口,浏览到包含表单的页面,然后爬文档树寻找某些元素的ID,从空白改变它们的值从Excel工作表中的非空字符串。然而,当我提交表单,表单逻辑将所有必填字段,如果他们还是空白,画一个红色框周围应该有问题的领域。 (Ⅰ可以通过点击到每个字段中,在所粘贴的数据的末尾输入一个随机字符,并立即将其删除此时介入,并且这触发了所需的场现在充满的逻辑。)

I've written an Excel VBA macro to paste some data into an AngularJS form -- it opens an Internet Explorer (11) window, navigates to the page containing the form, and crawls the document tree looking for certain elements by their ID, changing their values from blank to non-blank strings from the Excel sheet. However, when I submit the form, the form logic treats all the required fields as if they were still blank, drawing a red box around the supposed offending fields. (I can intervene at this point by clicking into each field, typing a random character at the end of the pasted data and immediately deleting it, and this triggers the logic that the required field is now filled.)

我不是一个JavaScript程序员,没有设计的形式(和我可以改变它以任何方式)。我可以操纵的DOM元素(聚焦和模糊的领域,例如,尽管这似乎不工作),我可能可以运行,可以进入浏览器调试器控制台的任何命令。是否有任何AngularJS专家知道一个比较简单的方法来强制的形式来检查自己?

I'm not a javascript programmer and didn't design the form (nor can I change it in any way). I can manipulate the DOM elements (focusing and blurring the fields, for example, though that doesn't seem to work), and I can probably run any command that could be entered into the console in the browser debugger. Would any AngularJS expert know a relatively simple way to force the form to check itself?

推荐答案

你有没有解决了这个问题卡里姆或找到任何解决办法?最近,我有我的一个项目,同样的问题。试图找到与标签NG-提交像我有什么'NG-提交=提交($事件)。我引用的表单元素和使用.submit。在你的情况,试试这个:

Have you solved this problem Karim or found any solution? I recently had a project of mine, with the same problem. Try to find the tag with ng-submit something like what I have 'ng-submit"=submit($event)"'. I referenced the form element and used .submit. In your case, try this:

设置HTMLFormEl = HTML.getElementById(accountNameValue)

Set HTMLFormEl = HTML.getElementById("accountNameValue")

HTMLFormEl.Submit

HTMLFormEl.Submit

提交是解决我的问题之一。让我知道这对你的作品。

The 'submit' was the one that solved my problem. Let me know if this works for you.

的不是VBA也不AngularJS专家,但我注意到,AngularJS没有任何治疗必填字段做,因为如果他们还是空白。只需要找到正确的事件来触发。只是我的意见。的