Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Can I make an Input_Box "Read_only"?


Hi,

I have an app that is supposed to be the frontend to a simple database.

There will be a lot of people working with this who wil be assigned one of three roles
=> According to their role, they will have RO or RW access to the fields.

==>> I am just creating three sheets, one per role

==>> For all the fields that people can edit, they shall get input_boxes

==>> For those which they can only view, they shall get text_boxes.

That way, though, I cannot make it dynamic (in case the association_structure changes) because from a text_box, I cannot easily make an Input_box. I would have to create both and then decide dynamically which one to show which means a lot of variables.

=> Is there a way I can lock input_boxes and make them read_only? That would be an easier way to switch  between the two and I
     would need only one sheet for all three roles
     (I just notice there is a radiobutton in the dialog, but that doesn't help me because I cannot use an expression to switch that.

    => Can I somehow use the edit_field with the "customized" option of this radiobutton?

Thanks a lot!

Best regards,

DataNibbler

14 Replies
sunilkumarqv
Specialist II
Specialist II

marcus_sommer

Hi DataNibbler,

within the tab "Beschränkungen" / "restrictions" there is an option for read only.

- Marcus

datanibbler
Champion
Champion
Author

Hi Marcus,

yes, I have now seen that option. But that is a radiobutton, there seems to be no way of governing this through an expression - so I cannot have one object that will automatically switch between RO and RW, so it doesn't help me. Sorry.

@ Sunil

I will have a look at these links now.

P.S.: I had a look at this blog before. It describes m.o.l. what I have done - in my app, the user is also able to either load the existing database_qvd or (after he has made edits to one record) store it back to qvd.

However, this doesn't help me with regard to locking my input_boxes for those users who can view, but not edit certain fields.

marcus_sommer

Hi DataNibbler,

I'm not sure bu try the button above "user defined" and as expression something like if(osuser() = 'x', true(), false()).

- Marcus

vincent_ardiet
Specialist
Specialist

It's a bit dirty but you can put a transparent textbox in front of your input box with a conditionnal layout, so if displayed it will avoid users to activate the input box.


datanibbler
Champion
Champion
Author

Hi,

the manual says that the expression entered there must return either TRUE or FALSE and the variable itself appears as $ - so putting '$<>$' should disable it.

I'll try.

Alternatively, I could put '$ = [field]', using the field as it currently is in the database - that way, the user would  not be able to enter anything else than what is already there.

Let's see.

datanibbler
Champion
Champion
Author

Hi Vincent,

good idea, but it's not quite what I want: There are two kinds of people

- Those who are supposed to be able to view, but not edit a field, get a textbox (which cannot be written to)

- Those who are supposed to be able to view AND edit a field get an InputBox (which can be written to)

=> There would of course be a possibility (or several) using two objects for each field
    <=> I am trying to have just one object per field.

Best regards,

DataNibbler

datanibbler
Champion
Champion
Author

All right.

Seems that does the trick: By putting >> $ <> $ << in that edit_field for "customized" in the dialog, I can actually make every possible entry invalid - and as soon as one has pressed > Enter <, an error_message appears and the original content of the variable reappears.

That way, I guess I can do with one object per field that I switch between RW and RO access. Simultaneously, I can switch the background colour of the InputBox to signal that it can or cannot be edited.

Let's see if this works.

datanibbler
Champion
Champion
Author


Oops - now the variable seems to be running amok. I can now click anywhere on the sheet, wherever I want, and I always get that error_message ... I'll have to delete the sheet.

That seems to happen always - so I cannot use that. Well, I can use it to enter certain restrictions, but not to disable editing altogether.