Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1550
  • Last Modified:

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

Hello,

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.

Thanks!
Joseph Irvine
0
jkeagle13
Asked:
jkeagle13
  • 4
  • 3
1 Solution
 
clayfoxCommented:
The simple answer is just have a column for the record type.  I assume you may already have one in the list to designate this, if not add one.

Then have the button set this value to one of your three choices (based on the button they select) right before it switches to the view.

Have a rule on open which switches to the view that corresponds to that value. This way when they edit or look at an existing entry it will go to the correct view.

Yah you have to hardcode the values to each of your views, but with only three views I am guessing it would not require much maintenance. Only if you wanted a new type.
0
 
jkeagle13Author Commented:
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!
0
 
clayfoxCommented:
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jkeagle13Author Commented:
Hello,

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!
0
 
clayfoxCommented:
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?
0
 
jkeagle13Author Commented:
Hello,

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.

Thanks!
0
 
clayfoxCommented:
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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now