Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to open different forms for different SharePoint list views so I need to get current page full URL on an InfoPath 2010 form. How can I do this through XPath or XQuery?

share|improve this question
add comment

1 Answer 1

Probably you do not need full URL but only that part that triggers default views?

Most Infopath 2010 controls have "Insert Function..." button where you can choose various URL functions, related to your context

For example, here is an image of text box properties in context of infopath form for (in context of) a list:

enter image description here

Now, when you tell about Xpath or JQuery, you most probably do not understand that Infopath is codeless approach to crating forms.
Even more, in browser-enabled Sharepoint List Form type (which only make sense for your questions) Infopath forms the custom code is IMPOSSIBLE at all!!!

Take it or leave it altogether.

Update:
Infpath form is just XML-based from, i.e. just XML data used by, for ex., Sharepoint Server 2010 for rendering this form at runtime.

The same IP form is used, depending on context, in different web pages.

As such, determining a web page URL from inside of and by means of Infopath form, by quering its own XML data does not make sense to me. IP form does not control its use, it is just being used from outside. Page URL is external data for IP form, you should get this URL outside of IP form and pass/return it to Infopath Form Web part, if you want to show it there.

You can't learn dynamic or run-time or external data by querying internal or static or XML data of infopath form. You can provide it by external means only and use it by external means only.

How to do it is another and different question

For example,
create web part detecting full page URL. I hope it is easily searchable in internet.

On design surface of web page in browser (Site Actions --> Edit Page), place this web part and in your Infopath Form Web Part click small-black-down-arrow drop-down-list on the upper right corner ---> Connections --> Get Data (Filter Value) From --> Click the name of your placed web part --> on the following popup dialog choose the field where to put caught data in "Consumer Field Name" drop-down list.

share|improve this answer
    
Yes, I need only a part of page URL, actually, I need site page name, like .../../MyPage.aspx I want to learn page URL to decide to open a custom InfoPath 2010 form view. I guess this can be learn through XPath or XQuery, not JQuery. And again yes, InfoPath is a codeless approach to create forms but you can type custom XPath codes on there. –  compengTR Jun 18 '12 at 16:25
    
Updated my answer –  Gennady Vanin Novosibirsk Jun 19 '12 at 3:10
    
Once again, you cannot get it from Infopath form because the same Infopath form is used in different contexts and web pages. It cannot know how it will be used –  Gennady Vanin Novosibirsk Jul 8 '12 at 15:10
    
"Even more, in browser-enabled (which only make sense for your questions) Infopath forms the custom code is IMPOSSIBLE at all!!! " </p> Sorry, why? Browser-enabled IP-forms have some restrictions, but you can use code in it –  user10955 Sep 26 '12 at 4:37
    
-1 for "the custom code is IMPOSSIBLE at all!!!" –  RJ Cuthbertson Oct 2 '12 at 17:35
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.