Contact Selector on changed event doesn't seem to fire correctly unless the page has been posted back - InfoPath Dev
in

InfoPath Dev

Contact Selector on changed event doesn't seem to fire correctly unless the page has been posted back

Last post 04-12-2011 05:16 PM by phil2811. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-12-2011 04:06 AM

    Contact Selector on changed event doesn't seem to fire correctly unless the page has been posted back

    Hi All,

    I am pretty new to InfoPath browser forms 2010 and SharePoint 2010 development and I have been attempting to determine the manager of a staff member that is entered into a contact selector (people/group chooser). So I have created a changed event for the contact selector that passes the value in the contact selector to the userprofileservice and returns the manager and updates another field on the form. The problem is that when I click the button on the contact selector, the display name updates in the contact selector but the name of the manager doesn't appear in the text field. I think there may be a post back issue, because if I click any of the form's menu buttons, such as print preview, submit(with validation errors), close(then cancel the close dialogue) the manager's name updates in the field on the form.

    Then, every time I change the value in the contact chooser after that initial post back the manager name updates every time in the text field. When I open a new form in the browser the changed event doesn't fire correctly again. I have tried to debug this in preview mode, but the changed event runs first time, every time and returns the correct results. Are you aware of the cause of this issue and if it can be resolved?

     Thanks in advance,

     Phil.

     

  • 04-12-2011 05:16 PM In reply to

    Re: Contact Selector on changed event doesn't seem to fire correctly unless the page has been posted back

    Hi All,

    I realised that after adding a name into the contact selector and clicking another area of the screen, the username was not changing to display name. This only updated when clicking the button beside the contact selector to update the name. I checked another form that we have developed where I knew that the name in the contact selector would automatically update when clicking another area of the screen and looked at its properties. The only difference was that its validation property was set to "Cannot be blank". I set this property on my form and now the contact selector updates when selecting anywhere on the screen after entering a username. Also, the changed event is now being fired correctly so the manager name is displaying is another contact selector that I have on the screen.

    I don't understand why the "Cannot be blank" validation property needs to be set for the Changed event to correctly fire and update other fields on the form(if I haven't performed the steps in above comments). If anybody knows the reason for this I would be interested in learning about it, as I wouldn't want to have all contact selectors set to be required just so the changed event fires correctly on the contact selector.

    I could have used rules, but I wanted to use code to access the userprofileservice as I wanted to re-use the getManager() method in other areas of the form.

    Thanks,

    Phil.

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.