Can you use a List Form web part on a page to open an existing list item or a new item if the list item is not found?


Badge +2


We use Pages in SharePoint to display all our Nintex Forms for editing.  This is my scenario.  I have a page that has a List View web part that shows a view of all the list items for the current user sorted by the most recent first (the one we want them to edit).  I have a second web part on the page that is the Nintex List Form web part.  I set the Connections between the two web parts to send the ID of the first row in the List View web part to the Nintex List Form web part.  This works great if the current user has an existing item.  What I would like to do is have it so when they go to the page it will open up their most recent item in edit mode or open up a new form for them to fill out.  Is this possible?

 

Thanks,

Ben


8 replies

Userlevel 7
Badge +11

Hi Ben,

the Nintex Forms List Form web part can either be a New, Display or Edit mode.  You pick that in the configuration of the web part.  It doesn't support being in New mode if there's no item to Display.

You may need to look at having multiple web parts on the page.

cheers,

Vadim

Badge +2

Vadim,

   Thank you for the reply.  Do you have an example of how I can do this with multiple web parts?  What would the overhead be for having multiple web parts and only displaying one at a time?

Thanks,

Benjamin

Userlevel 7
Badge +11

Hi Ben,

I don't see their being a big overhead for this.  I don't have an example, but basically, you just install two Nintex Forms web parts.  One configured to be New.  The other, configured to be an Edit form and connected to your List View web part.

cheers,

Vadim

Badge +2

Vadim,

     That is what I was thinking on how to do it, but how would you code it so only the one Nintex Forms Web Part shows at a time?  If the current user has an item in the list form, show the Edit Form.  If they are not found, show the New Form.  I am not sure how to code it that way.

Thanks,

Benjamin

Userlevel 7
Badge +11

Hi Ben,

I don't believe this is functionality that is out of the box.  So you would need to do something special here to hide/show the appropriate web part.  This would not be part of Nintex Forms,  because it'd be SharePoint functionality.

cheers,

Vadim

Badge +2

Vadim,

 

   I think I have a solution (it works anyway    )  This is what I did.  I created a page and added 4 web parts.  The first web part is a Content Editor web part and it is hidden.  I added the following in the HTML:

 

<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($){

$('.ms-WPBody:contains("Please provide a valid list item ID.")').each(function () {
    $('.ms-WPBody:contains("Please provide a valid list item ID.")').parent().hide()
});

});</script>

 

The second web part is a hidden List view web part that is a view of the current users item(s) with the most current one listed first.

 

The third web part is a Nintex List Form web part set to Display with the connections set to the List View web part above.

 

The fourth web part is a Nintex List Form web part set to New.

 

The JQuery above will check to see if the Display web part shows and item and if not,  it will hide it.  I also set the Chrometype to none on the web parts.

 

You will also need to check the body to see if it displays a valid item.

 

Not sure if this is an efficient way of doing this or if there is a better way, but it seems to work pretty good.

 

Thoughts?

 

Thanks,

Benjamin

Userlevel 7
Badge +11

Hi Benjamin,

wow that's an elaborate solution and I'm impressed.  Nicely done!!

I honestly have no idea how else you would do this.  As to efficiency, I can't see there being too much of a hit on the rendering of the page for something like this, unless that user has thousands and thousands of items that would go into the ListView.

Well done.

Vadim

Badge +4

I am having trouble and have a question.  What ID do I need to use in the js?  I've tried my list ID and the hidden list webpartID?

I am putting in this line of the js:  "Please provide a valid list item ID."  What exactly am I looking for?

Thank you!

Reply