在信息路径表单中制作一个单选按钮“只读”?

发布于 2024-07-23 07:43:42 字数 533 浏览 4 评论 0原文

我正在制作一个与 Access 数据库绑定的 InfoPath 表单。 我有一组单选按钮,用户可以在其中选择与表单相对应的软件名称,但我将其作为数字(1、2 或 3)存储在数据库中。 从另一个角度来看,我希望他们能够看到之前输入的软件名称,但无法更改它。 以下是我想到的两个选项:

  1. 创建一些规则来阻止用户更改此数据

    这似乎是我想做的事情的自然方法。

  2. 添加一个文本字段,其中包含将每个数字映射到相应软件的功能

    由于表单与数据库绑定,InfoPath 希望所有字段都与数据库值绑定,这需要创建另一个数据库条目。 我也无法找到可用于处理此映射的 InfoPath 函数。

  3. 将单选框的变量更改为文本值,并在新视图中创建一个文本框,该文本框可以设为只读。

    我真的不想这样做,因为它会让使用此数据库值的其他程序变得更加混乱,并且看起来很浪费,但如果没有其他办法,这似乎是可行的。

我可以使用某种规则/方法使该单选按钮控件变为只读吗?

I'm making an InfoPath form which is tied to an Access database. I have a set of radio buttons where the user selects the software name corresponding to the form, but I store this in my database as a number (1, 2, or 3). In another view, I want them to be able to see the previously entered software name, but not be able to change this. Here are the two options I've thought of:

  1. Create some rule that does prevents the user from changing this data

    This seems like the natural approach for what I want to do.

  2. Add a text field with a function mapping each number to the corresponding software

    As the form is tied to the database, InfoPath wants all fields to be tied to a database value, which would require creating another database entry. I'm also having trouble finding an InfoPath function I can use to handle this mapping.

  3. Change the radio box's variable to text values and make a text box in the new view, which can be made read-only.

    I'd really prefer not to do this, as it will make things messier for other programs using this database value and seems wasteful, but if nothing else works, this seems do-able.

Is there some sort of rule/method I could use to make this radio button control read-only?

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

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

发布评论

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

评论(1

花心好男孩 2024-07-30 07:43:43

您可以使用条件格式来禁用任何控件(包括单选按钮)。
要将控件设置为始终禁用,请执行以下操作:

  1. 右键单击控件并选择条件格式...
  2. 单击添加...
  3. 在最左侧的下拉列表中选择 >表达式
  4. 在文本字段中输入true()(这告诉 InfoPath 始终应用此格式)
  5. 选中禁用此控件复选框。
  6. 单击确定确定

注意:您需要对每个单选按钮执行此操作。

另外,供将来参考:如果您只想显示函数的结果(例如在第二个解决方案中),则不需要使用文本框。 您可以使用表达式框。 表达式框不一定链接到数据源中的字段,因此您不需要在数据库中为其添加额外的列。

You can use conditional formatting to disable any control (including radio buttons).
To set your control to always be disabled do the following:

  1. Right click on your control and select Conditional Formatting...
  2. Click Add...
  3. In the leftmost dropdown select The expression
  4. type true() in the text field (this tells InfoPath to always apply this formatting)
  5. Check the Disable this control checkbox.
  6. Click OK and OK.

Note: You will need to do this for each of your radio buttons.

Also, for future reference: If you simply want to display the result of a function (such as in your second solution) you don't need to use a text box. You can use an expression box. An expression box is not necessarily linked to a field in the datasorce, so you won't need an additional column in your database for it.

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