Populate Textbox with Title of Current View in InfoPath SharePoint List Form
Posted on 2013-05-20
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.