Google app maker 如何在appmaker中禁用表单的所有元素,而不为每个元素编写代码?

Google app maker 如何在appmaker中禁用表单的所有元素,而不为每个元素编写代码?,google-app-maker,Google App Maker,我在appmaker中有一个表单,它有许多(至少20-25个)输入元素。 我想通过代码禁用所有元素,而无需为每个元素编写单独的禁用行代码 我试着使用for循环来做下面这样的事情,但没有发现运气,因为它不正确 for(var i=0; i< app.currentPage.descendants.Form1.children.length; i++) { app.currentPage.descendants.Form1.children[0].enabled=fals

我在appmaker中有一个表单,它有许多(至少20-25个)输入元素。 我想通过代码禁用所有元素,而无需为每个元素编写单独的禁用行代码

我试着使用for循环来做下面这样的事情,但没有发现运气,因为它不正确

  for(var i=0; i< app.currentPage.descendants.Form1.children.length; i++) 
   {
     app.currentPage.descendants.Form1.children[0].enabled=false;
   }
for(变量i=0;i

有没有一种方法可以一次禁用它们?

这是未经测试的,但请尝试以下操作:

var children = app.currentPage.descendants.Form1Body.children._values;

for (var i in children) {
  children[i].enabled = false;
}
请注意,我使用Form1Body而不是Form1,因为顶部的Form元素由页眉、正文和页脚组成,所以在Form1的子级上循环时,实际上引用的是3个单独的面板,而不是输入元素