Expand my Community achievements bar.

SOLVED

Help regarding protected fields

Avatar

Level 9

Hello All,

I have a form which has several fields. Out of those some are protected fields which are only meant for Administrator, rest are meant for general users.The general users need to submit the form by filling only those fields which are meant for them. After submitting the form , when the Administrator opens the form, he should be able to enter data into the protected fields and save it . How this can be achieved best, so that only the Administrator can work around the protected fields.

Thanks.

Bibhu.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Bibhu,

Here is a sample: https://acrobat.com/#d=1sM9qMpJpgo2Miox*YaQNg

In this I have set up four fields that are initially locked. There is a button, which when clicked will prompt the user for a password.

Now while the password is '124', the form uses a hash function to convert this into a hex code. I can't remember where I got the function, but it was from one of the Adobe blogs. It would be unsecure to store the password '1234' in the form, so the hash code is stored instead: '03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4'. The inputted password is converted to a hex code and then compared to this.

Once the fields are unlocked, the background is highlighted. To protected the fields again the Administrator clicks the button and inputs an incorrect password.

Now in your form you could take parts of this solution - e.g. have a password textfield instead of a button; have a lock script in the exit event of the textfields, etc.

Hope that helps, sorry about the delay in getting back to you,

Niall

View solution in original post

8 Replies

Avatar

Level 10

Hi Bibhu,

A suggestion would be a secret space originally given by kingphysh. There is a  thread and sample here: http://forums.adobe.com/message/3153349#3153349 In this example the Administrator would execute a sequence know to them to make a subform visible. The fields in the subform would be globally bound to the readOnly fields in the form.

Also you could use a dialog (for example AcroDialog from Windjack Solutions), but this may require you to have the username and password for the Administrator in the form. We use a hash key to make this more difficult to intercept.

Good luck,

Niall

Avatar

Level 9

Hello Niall,

Thanks for the link.What I think is I will put a messagebox on either the exit event or the enter event. It may ask for the password. If the password is correct (Incase an Administrator using it) then it will make the field editable.If the password is incorrect (incase of general users) then it will make the fields as readOnly.But here one question arises. What should be the behaviour of the field before entering the password? I guess it can not be achieved using protected field.I guess it should be user-entered to achieve what I said above . What's your take on this? Any better ideas ?

Thanks.

Bibhu.

Avatar

Correct answer by
Level 10

Hi Bibhu,

Here is a sample: https://acrobat.com/#d=1sM9qMpJpgo2Miox*YaQNg

In this I have set up four fields that are initially locked. There is a button, which when clicked will prompt the user for a password.

Now while the password is '124', the form uses a hash function to convert this into a hex code. I can't remember where I got the function, but it was from one of the Adobe blogs. It would be unsecure to store the password '1234' in the form, so the hash code is stored instead: '03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4'. The inputted password is converted to a hex code and then compared to this.

Once the fields are unlocked, the background is highlighted. To protected the fields again the Administrator clicks the button and inputs an incorrect password.

Now in your form you could take parts of this solution - e.g. have a password textfield instead of a button; have a lock script in the exit event of the textfields, etc.

Hope that helps, sorry about the delay in getting back to you,

Niall

Avatar

Level 10

Hi radzmar,

Yes that was the article - thanks

Niall

Avatar

Level 9

Hello Niall,

Thanks for the help.But while implemeting that I found the following error as has function is not defined.How to get over it with ? One more query - Should I use JavaScript or Formcalc for this ? If I use Formcalc then what should be the difference in the script.

Thanks.

Bibhu.Passworderror.JPG

Avatar

Level 10

Hi Bibhu,

The function is in a script object (see Variables) in the hierarchy. The click event of the button calls the function 'hex_sha256', which is inside the script object 'soHASHING_SHA256'.

You need to copy the script object from the example into your form. You can do that by opening the example and dragging the script object to your Fragment Library (next to the Object Library).

When you open your form, drag the script object into your hierarchy and right-click; from the Fragment menu select 'Convert fragment to an object.

Should work then,

Niall

Avatar

Level 9

Hello Niall,

I just created the script object in my form and copied that from the sample you have provided. It worked.

Niall , You are a GENIOUS

Thanks.

Bibhu.