Link to home
Start Free TrialLog in
Avatar of jkeagle13

asked on

Populate Textbox with Title of Current View in InfoPath SharePoint List Form


We have a SharePoint 2010 list form which we have been modifying with InfoPath. We have three separate views for adding new data. The user can select which view they want based on what type of record they are trying to enter. Each view prompts for a different set of fields. There is simply a single list. It is permissible for records to omit fields based on the type of record being entered; hence the multiple views, each of which including a different set of fields from the list to be populated.

One of the things we do need to do is have a textbox where the user enters the name of the record type they are entering. This is redundant, however, as the view they are on is the record type. So, if the view is "ABC Record," they would need to enter "ABC Record" into the textbox to track that the record was of that type.

We have a technologically illiterate user base so we have set it up with a landing page and three buttons. Each button links to a separate SharePoint page, where the InfoPath Web Part has been embedded, already linking directly to the appropriate view for the button the user selected.

In looking through the Internet, it appears that retrieving the current view name is actually far more difficult than it ought to be. I would have hoped to simply create a rule for Page Load, which would set the textbox in question to be equal to something like CurrentPage.ViewName, or something of that nature.

Everything I have read points to no solution quite so elegant. Is there something I am missing? A few solutions mention how to grab the current view name as the view is changing. That really isn't applicable to our situation, however, where we are embedding the InfoPath Web Part with the view pre-selected based on the page the user lands on.

Is there any XSLT, XQuery, Expression, etc., to accomplish this? I am hoping for something really simple, a solution basically where I can set a field equal to the name of the current view. I had hoped to do this with a button I created for submitting that I placed at the bottom of the page; but it only gives me formatting rules; everything else, such as action rules, are grayed out.

Joseph Irvine
Avatar of Clay Fox
Clay Fox
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkeagle13


I do have a column for type, and could have the form switch views on open based on user selection.

How do I set up a receiver in the InfoPath list form to read a value passed in concerning which button was pushed? And, how do I set the button to push a unique value corresponding to the view intended by the SharePoint button inside a CEWP on the landing page we built to the SharePoint InfoPath form?

Thank you!
You would have each of the three buttons on the new record set the specific type and then do not manipulate it after that until it saves.

put three open rules on the InfoPath form.
one if type equals first then switch to first view and so on.

not sure if you want a specific button in the list but you can certainly filter the list by type.

Right now my buttons are actually just PNG files on a blank page I have designated as a landing page, with hyperlinks to three SharePoint pages, each having the embedded InfoPath web part with a property of the view that page should represent.

How do I repurpose those to set "type," or create new buttons which set a "type" readable by an InfoPath load rule? I am afraid I have never set and passed a type using a button in SharePoint. Please feel free to defer to a site explaining the process as I didn't readily find one in a Google search, likely meaning I was using the wrong search terms.

I would just delete two of the three pages with embedded InfoPath web parts and have a single one, I presume, for which these buttons would dictate which view to load. I am just missing a piece or two of how to do that, but believe I am closer to understanding.

Thank you!
If there is a separate form for each list then just hardcode  the type as a default in each form. I guess I do not understand, I thought it was one list not 3.

do you just need to know how to link to a new template?

One SharePoint list, one InfoPath form, and three views on the form.

I have three SharePoint pages, one for each view. Each page has an InfoPath web part with the view desired specified in the web part properties.

I have a main page with three PNG images, each hyperlinked to the intended page with the embedded InfoPath form view.

I want it such that I can know in the form which view the user is using so I can set the column in the list with the name of the view.

So when they start a new record it is blank and foes to the default view right? Or you default to a specific view?
if you have a button for them to select the view they want change the value along with the view. When they save it will have the last view chosen and should then filter into the correct view in SP.