خاطرات فنی من

یادداشتهایی در مورد تجربیات فنی من به عنوان یک مهندس نرم افزار برای مراجعه بعدی خودم و احتمالا دیگران.

سعی می کنم مطالب برای دیگران هم قابل استفاده باشند اما به دلیل کمی وقت نمی توانم زیاد نگران نگارش و چینش متن باشم

دکمه های ریبون می توانند کمک کننده باشند. بعضی وقتها هم مزاحمند. مثلا وقتی می خواهید کاربر را از تغییر Viewهای فرمتان بازدارید(آیا کاربر راه دیگری برای تغییر view ندارد؟) . یا وقتی که می خواهید دکمه های خودتان را اضافه کنید.
به هر حال امروز من دو راه برای اینکار یاد گرفته ام. اولی از طریق خود infopath است. و دومی از طریق گزینه های Web part مربوطه.


1- فرمتان را باز کنید و در infopath به این مسیر بروید:
file menu -> info ->form options ->web browser
تیک Show infopath commands in ribbon را بردارید.
به همین راحتی از شر ریبون راحت شده اید.

2- این قسمت copy/paste از یک وبلاگ دیگر است به این نشانی:
(http://the-north.com/sharepoint/post/Remove-Ribbon-from-SharePoint-InfoPath-List-Form)


If you want to get rid of the ribbon and add your own buttons it's not too difficult. I should mention though that there's an easy way and a hard way of removing the Ribbon. Hard (but useful) way detailed here and the easy way detailed here. First off, see my InfoPath form below. That ribbon needs to go.

InfoPath Form

As mentioned in previous articles, InfoPath forms are hosted on web part pages. If you get into the edit view of the page the form lives in you can do interesting things. To do this, right click on the InfoPath form and select Properties. You'll be able to select the URL of the underlying page as shown;

Get Address of WebPart Page

Paste the URL from above into a new window. Remember to remove the IsDlg=1 parameter from the end of the URL to view the page properly. Now we find ourselves on a web part page, which we can edit like any other page. Here we see the InfoPath Web Part on the page, and we can modify the settings like any other web part;

Modify InfoPath Web Part

Unticking the box as shown below will get rid of the ribbon;

InfoPath Remove Ribbon

So now our form has no ribbon. We have more space, but it's kinda useless as we can't submit the data we fill in!

InfoPath Form Without Ribbon

Editing this form in InfoPath Designer I can add my own buttons to the form as shown;

Add Button To Form

I can change the text of the buttons and other properties by right clicking them and selecting Button Properties;

Change InfoPath Button Properties

Next I need to make the button do something. I do this by adding Rules to the button. For the Save Button I want it to submit my form data when clicked;

Add Rule To InfoPath Button

After it submits the data I also need the form to close, just as it would work if I'd clicked a button on the ribbon. I can add another step to close the form as shown;

Add Close Event to InfoPath Button

After adding a step to Close the Form when the Cancel button is clicked, I'm all set with a fully working form.

One little gotcha to look out for is that with the steps above I've only changed my new item form. The Edit and View forms have different URLs so if you want to change this for everything you may have to do it three times. This adds flexibility though as you can achieve quite different things on each form depending on your business requirements. (Have a linked web part on the edit form showing performance for that data graphically, the new item form might then show things differently.)

InfoPath Form Without Ribbon



موافقین ۰ مخالفین ۰ ۹۳/۱۲/۱۲

نظرات  (۰)

هیچ نظری هنوز ثبت نشده است

ارسال نظر

ارسال نظر آزاد است، اما اگر قبلا در بیان ثبت نام کرده اید می توانید ابتدا وارد شوید.
شما میتوانید از این تگهای html استفاده کنید:
<b> یا <strong>، <em> یا <i>، <u>، <strike> یا <s>، <sup>، <sub>، <blockquote>، <code>، <pre>، <hr>، <br>، <p>، <a href="" title="">، <span style="">، <div align="">
تجدید کد امنیتی