>InfoPath Validation Event Handlers

>I have been developing a complex solution using InfoPath to gather user information before it is processed by a SharePoint / Windows Workflow foundation solution.

One of things that the client wanted to was make use of file attachment controls. One of the requirements that the forms were only available on infopath form services. However this causes problems as we cannot validate the file attachment control.

In order to get round this we can programme a event called OnValidate_ControlName which is fired when a field has changed.

The handler provides an argument, ‘e’ which allows you to interact with InfoPath.

The keys properties of e are the following:-

  • Operation = this is the XmlOperation type that is occuring. This can be none, insert, delete and value change.
  • Site = this represents the XPathNavigator for the control that is being checked.
  • NewValue / OldValue = available for the value change operation type. This gives the developer a means to check the new and old values.

When I write an event validation function, I split the checks by Operation type. Therefore validation can be done based on the type of event.

Operation Type

The operation types are one of the following:-

  • None – fired when the form opens.
  • Value Change – fires when a value of a field is changed.
  • Insert – fires when an insertion occurs with a repeating table.
  • Delete – fires when a deletion occurs within a repeating table.

Using this method you can reduce the complexity of the checks for example you may only check that a field requires a value when a field is changed or a repeating table is inserted (to prompt the user to fill out the field.) The none operation can be used to pre-empt the user to fill out a value for a field as soon as the form is opened.

Reporting Errors

Once a problem is found, the user can be informed by the e.ReportError() function, which asks you to provide an XPathNavigator object pointing to the node with the problem. This is normally the e.Site object. There are a couple of other parameters, called Site Independent and message. The message parameter allows you to provide a simple message. An other override of the message allows more detail to be inserted. This is displayed in a separate message box.

The site independent is used in regards to when the fault clears and whether a change has to be validated against the same control or through a group control (such as a repeating table repeating field.

Tying things up

Programming this way provides some validation that is not possible in the out of the box solutions and provides a way to provide much better methods to interact with the user.

One Comment

  1. Could HGH Products Increase Lean Body Mass

    HGH, human growth hormone could be the hormone within the
    human body responsible for retaining its health and integrity together with increasing lean body mass.
    The clinical title for this hormone iss somatotropin.
    Maany individuals appear to misread the nature oof HGH whil in the human anatomy and don’t grasp precisely what
    this hormone does.

    Individual growth hormone is capable of stimulating the growth of lean body mass, repairs to
    broken cells, and substitute of dead ones. As time goes by we naturally
    start to generate less of it over a daily basis.
    In the age of twenty the typical production degree of somatotropin
    in the body will waver between four hundred and five hundred micrograms.
    This is centered on activity-level and sometimes gender.
    This production may fall to approximately half that amount at age forty.
    However, by the moment this individual reaches age ninety
    they’ll develop around twenty-five micrograms to the average.
    Which means the average individual can generate twrnty times less HGH
    to the average at age eighhty while they can at age twenty.

    Supplements for HGH aren’t actually giving the body more human growth hormone.

    These supplements give significant proteins that the anterior pituitary glands uses to make HGH.
    This doesn’t suggest they are cons or nugatory. They do work, and work properly for the purpose oof aiding
    inside the increase of lean body mass.
    what are the best supplements to take for muscle growth
    Nevertheless, it ought tto be noted that there
    is a weird strategy that applying HGH supplements will turn an average individual in to a super human
    muscle-building machine. This is not true. A great, strong,
    HGH supplement will continue to work well for many people and
    be virtually useless for others. You’ll find
    two principal elements that determine how well a proper product works for you.
    Those aspects are age and activity.

    http://www.ethz.weact.ch/content/fiber-supplements-excess-weight-loss

    An eighty year old person that operates out every single
    day will find that a great product will support them out
    to an incredible, practically staggeringly helpful, stage.
    A twenty year old man or woman that rests around playing video gaming all time and consuming potato chips will scarcely notice any transform
    at all. In every honesty a twenty-year aged power-lifter will not be probable observe that much difference either.
    The truth within this matter is that HGH supplements can help increase lean body-mass
    but only in people that need the boost. A new
    highly active individual already provides the maximum amount of HGH the body
    may use naturally anyway. The rest is lost. For these individuals
    they’d bbe better supported bby way of a simple multi-vitamin.
    To pressure the body to construct notably greater amohnts of muscle mass using HGH inn a newer age will require the use of injections.
    This is a normally illegitimate strategy without medical causes.

    Reply

Thoughts? Comments about this post? Please leave them here..

This site uses Akismet to reduce spam. Learn how your comment data is processed.