Can't Hide Field

jmahun 23 Aug, 2015
I have a form which is used to edit a logged in user's record. In On Load I use Custom Code to determine the username and user ID. The user ID is used to load the record for editing.

On the form I have various fields the user can edit to update the record. I also include two hidden fields: cf_id and user_id which correspond to the record number and user ID respectively.The problem I have is that even though the two fields are set to hidden, they are still visible on the edit form and the user can alter their contents. Because the form writes the changes back to the table, the user can screw up the record. I need the cf_id field (at least) on the form or a new record gets added to the table instead of updating the existing one.

I tried putting them in a container and hiding the container also (set container type to div) but they still appear on the form.

Why, when I have the fields set to hidden, do they still appear on the form?

JMahun
GreyHead 23 Aug, 2015
Hi JMahun,

I have no idea and it is impossible to tell from the information here. If they are really hidden then they aren't visible . . .

You can get the User ID after the form submits so there is no need to have that in a hidden input, the record ID you may need (unless that can be looked up again).

To pass data like this you can either use a hidden input or an ordinary input set to readonly so that it cant be edited.

Bob
jmahun 23 Aug, 2015
I don't really need the user_id field so I removed that from the form. The cf_id field, on the other hand, is needed so the record is modified rather than a new one being added. There's only one record per user in the table and the "hidden" cf_id field helps ensure that.

The form is called directly as a menu item, which is only visible for logged in users. As I said, Custom Code is used to determine the logged in user's ID to load the correct record from the table. Everything works as intended except for the fact the hidden field isn't hidden. I tried setting the state to Disabled, but the field is still editable on the form.

Interestingly, for another application I use a ChronoConnectivity connection to load a form for editing a record. The form in that case similarly uses a hidden cf_id field which does in fact stay hidden.

JMahun
jmahun 23 Aug, 2015
Answer
1 Likes
OK, I think I figured out what was wrong.
I was using a Text Box for cf_id and was setting its Load state to Hidden.
I instead tried using a Hidden Field for cf_id and cf_id does not appear on the form.

I was thinking "hidden" in terms of the Text Box Load state, not as a different field type.
Duh.

JMahun
This topic is locked and no more replies can be posted.