making infopath form read only

A

Adam

Please advice how do I make after an InfoPath form which a user already
filled (and submitted), to become read only mode. What I mean that after the
form was filled the fields and data will be viewed only (read only mode)?
Thanks
Adam
 
V

vt_asparagus

I do not know of a magic method that will disable the entire form. The
only way I know is to add conditional logic to each control of the form
to make it read-only or create a read only view. What you do is driven
by your implementation.

If you have a field in your form that will indicate if the form is
read-only you can use that. For instance, you could add new element to
your main data source and call it "readonly" that will be of
Boolean type. You can then set that to true when the user presses a
submit button for instance. Then all of your controls on the form
would use conditional logic to check that field. Although that is a
quick and dirty solution and is not secure if the intent is not allow a
user to modify a form after they have submitted.

Another option would be to allow users to sign data with a certificate
which would lock down fields so they are not editable.

There are many other options.

Hope that helps.
 
F

Franck Dauché

Hi,

You could do as described above, but you will have to hard code in each
control (which will hit performance and is long to do).
Another way to do this would be to catch the OnBeforeChange event being
fired and to cancel it by code behind your form:
in C#, e being your DataDOMEvent, use:
e.ReturnStatus = false;
Also, you can display a custom message before this line using for example:
e.ReturnMessage = "This form is read-only!";

This is another way to solve your problem...

Regards,

Franck Dauché
 
V

vt_asparagus

That is an interesting solution, had not thought about that. Would you
define the OnBeforeChange event handler on the ROOT node of the schema
so all changes to the form would be checked? Only problem I can see is
if that this would only work good if you plan to make the entire form
read-only. If you only wanted to make groups of data read-only I would
assume that would not work well.

Think the only point to make is that no matter what sort of conditional
logic is put into the form to make data read-only, that does not mean
it is secure. You would have to digitally sign the data to ensure the
XML is not tampered with. Although I think that was outside the scope
of the question.
 
F

Franck Dauché

Well, you can rebuild the XPath form your event e. Then, based on where you
are, you may use or bypass that code. Point is, you could build simple or
complex logic that would allow you to control which part of your form should
be read-only even if you are indeed starting from the Root.

But for a smaller form, your solution is great as well. Pros and Cons in
both cases....

Franck Dauché
 
K

Kenneth

There is no perfect solution for "read-only". Some controls can not even made
read-only by conditional or rule. Even you can, it is not a neat solution if
you have hundreads of controls.

I do believe this is a major flaw of InfoPath design. I hope MSFT can
provide a ready-only attribute for a whole view, in next service pack or
release. This is nearly a must have for a workflow solution.

Kenneth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top