Form data input table - disable a column for the user

I have a DataTable

image

and I use it in a form as data in a Data Grid:

image

But now I have an issue. I don’t want the user to edit Column1 data.

So how can I disable the Column1 completely in the form frontend?

Cool would be if I can apply some CSS like:

“attributes”: {
“style”: “column1: disabled;”
},

I know that’s non valid CSS code. Just as pseudo code. Thanks.

Wherever you’re using the datatable (myDT) as an input, you can replace myDT with:

myDT.asDataView.ToTable(“Column 2”, false)

1 Like

Cool thanks. But that gives me as follows:

image

Thats not correct. I need one table for Column1 and the other that should be editable only contain Column2.

How is that possible?

In that textbox of the datagrid mark the property “Disabled”:


image
And it will look like this:

Regards.

1 Like

That looks like what I need “Adry”.

Could you show some more details? So you have 1 or 2 dataTables? What is your field collection in the Form activity? How you connected it in the form designer? Thanks

I’ll show you step by step how I did it.
I have a DataTable with these values:
image
Then I create the form and add a datagrid and name it “dataGrid1”.


I add two textboxes, one for each column and name them after the name of the datatable column, in this case, “nombre” and “edad”.

We don’t want the first column to be editable, so I set the “nombre” textbox to “Disabled”.

And finally in the “FormFieldsCollection” property of the form I match the name of the datagrid with my datatable (in and out direction)

P.S. Sorry for the text in Spanish but I have the uipath studio in that language.

Greetings.

1 Like

Sorry but nothing looks like in your images.

Let me show you how I see it following your images.

  1. image
  2. image
  3. image

So I have no preview of the Table like you have.

Can you see my issue, or maybe you use a different Studio version?

Ok, I know what happens. I am not using the pro version, I am using the 2021.10 community version.

I do not have a table preview, I have added the fields manually.

I don’t have a preview of the table, I added the fields manually.

The first thing is to add the datagrid as you already have and then add the components by dragging a couple of textfields into the Data Grid. Those textboxes then you have to call them the same as the column of the DataTable (change the name of the column in the data table) and the one corresponding to the column to disable, check the “Disabled” checkbox.

I leave you also my example that I made

Main.xaml (10.1 KB)

1 Like

Ahh ok you seem to use a totally different “Create Task Form”?

image

Can be because the activity is not shown to you.
image
I’m using UiPathForm.Activities in its version 1.7.1
image
The activity in question
image

1 Like

Installed the Form.Activities and now your “Create Form” works.

Indeed your Form seems to work.

Now I wanted to create the same form on my own directly underneeth:

But the designer does not show anything:

I am really confused why it works on your activity.

Maybe I just forget something on setting up the form?

Can you go into more detail like

  1. Create Form
  2. Edit FormFieldCollection (Add in_DTTest In DataTable DTTest)
  3. Go Form Designer (Add a Data Grid)
  4. Set Field Key to “in_DTTest”

What am I missing?

Indeed, when you create the form it is blank, now you have to add the fields:
*Continuing where you left off.
5. In the Form Designer, go to “Basic components” > “Text box” and drag it into the Data Grid.
image
6. Edit the “Field Key” of the text box and change it to the name of the database column (DataA).
6.1. This field is the one we are going to leave disabled, in “Display” check the “Disabled” checkbox.
7. Save it and repeat step 5 and 6 for the other column (drag another text box inside the data grid and change the “Field Key” to the name of the other column (DataB)).

1 Like

Ok I solved it. I forget to add the “Text Fields” manually. I thought those are created by reading the given DataTable.

Anyway works now.

But I have a last question.

image

How can I set some CSS on the disabled Textfields of the first column?

You might never been using the Creat Task Form, right?

If so its fine. This is a nice to have. :slight_smile:

1 Like

Great! I’m glad I could help you.

I have only used Form Activity.
For the CSS, checking the “disabled” checkbox in the textbox should change its class to “disabled” as well and change its appearance.

Sadly not as you can see from my image where Column 1 is disabled but has same background color like Column 2.

It’s strange, so I should change.
Can you pass me the xalm to see?

Just replace the “Create Form” with “Create Task Form” and have a look in the Action Center of Orchestrator.

I don’t think you need my xaml as its very easy to replace it. :slight_smile:

Sadly the docs concerning CSS is empty:

Ahh and btw in the Preview it looks perfect.

But finally in Action Center it’s wrong.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.