重置整个节点 InfoPath 2007

发布于 2024-11-05 02:06:29 字数 136 浏览 3 评论 0原文

我已经构建了一个 InfoPath 表单。我想要做的是有一个重置按钮,可以清除填充数据的整个节点。我已经看到了一些解决方案,但这似乎是一个相对简单的页面请求。有没有一种快速方法可以将整个节点重置为其默认配置?

提前致谢!

马特

I have an InfoPath Form built. What I am looking to do is have a reset button that clears and entire node of populated data. I have seen a few solutions out there but this seems like a relatively simple request of a page. Is there a quick way to reset an entire node to its default configuration?

Thanks in Advance!

Matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小霸王臭丫头 2024-11-12 02:06:29

这似乎已经解决了。

private void ClearNode(XPathNavigator nodeToClear)
{
    if (nodeToClear.HasChildren)
    {
        nodeToClear.MoveToFirstChild();
        do
        {
            ClearNode(nodeToClear);
        } while (nodeToClear.MoveToNext());
        nodeToClear.MoveToParent();
    }
    else
    {
        nodeToClear.SetValue(string.Empty);
    }
}

之后,您只需调用要清除的任何节点并将其作为 XPathNavigator 传入即可。它解决了我存储的所有内容,但我很好奇它将如何处理具有布尔值等默认值的重置字段。

This seems to have solved it.

private void ClearNode(XPathNavigator nodeToClear)
{
    if (nodeToClear.HasChildren)
    {
        nodeToClear.MoveToFirstChild();
        do
        {
            ClearNode(nodeToClear);
        } while (nodeToClear.MoveToNext());
        nodeToClear.MoveToParent();
    }
    else
    {
        nodeToClear.SetValue(string.Empty);
    }
}

After that you just call whatever node you want cleared and pass it in as an XPathNavigator and away you go. It solved everything I was storing but I am curious how it would handle resetting fields with default values like a boolean or something.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文