user cannot submit the form


Badge +3

Once the form is submitted, user cannot submit the form  again for 24 hours. how to achieve this? 


11 replies

Userlevel 5
Badge +13

What is the use case for this? Also, do you only have Nintex Forms or also Nintex Workflow available to you?

Badge +16

If you have workflow you could use set item permissions and some kind of pause I guess - what happens to the item in that 24 hours?

Badge +3

In nintex form, user is filling the data and saving to the list. so, there are some approvals to happen in that 24 hours, so user should not submit the form in that 24hours from the time of submission.

Badge +3

item will be stored in the sharepoint list. user should not submit the form again in that 24 hours, can you suggest any idea

Badge +16

Are you using workflow?

Badge +3

yes. my requirement is,

i will submit the form for the first time, then it should save in the list.

next if i submit the form again within 24 hours then form should not get saved, it should show error message please submit the form after 24 hours like this

Userlevel 6
Badge +15

based on what you've said here, it seems like your requirement is that the user should not be able to resubmit prior to approvals / rejections - not just "for 24 hours."

in which case i'd suggest using a workflow - once the item is submitted, lock it down for only the admin (or whoever is doing approvals), and unlock it once approved. You could even hide the submit button to the initiator, or hide an entire panel, or remove their permissions entirely. Lots of options. 

Badge +3

Thanks for your reply, but i need only for 24hours , user should not submit, anything can be done in the form itself?

Badge +3

It will go for approval, but user needs the validation in the form itself so that 2nd time if user tries to submit it should not get submitted

Userlevel 6
Badge +13

To clarify, are you looking to suspend the users ability to submit any new forms for 24 hrs after they've submitted a form?

If this is the case I would use workflow and SharePoint groups to manage this. Assuming all users are in the Members group, I would remove them from this group and and add them to a SharePoint group that has only Read access to the list, and then pause the workflow for 24 hrs. Once 24hrs elapses you can then remove them from the "Read only" group and add them back into the members. This will allow them to continue to view the site without have the create permission required to create a new form or edit an existing form.

I got the impression you wanted them to be allowed to create new forms still but not submit them for that 24 hrs period, is this the case? If so, then rather than put the users in a Read Only group, instead put the user in a group that still has create permissions, but on the form, place some sort of validation to check whether the user is in that group, and if so the form cannot be submitted, only saved. Off the top of my head, I'd say you could have a Save button and a Save and Submit button, and the Save and Submit button is disabled if the user exists in our new group. Again, after 24 hours the workflow removes the user from our new group and the Save and Submit button becomes available again.

The same principle will apply if you are looking to just stop the user from resubmitting the existing form, add them to a group with limited permissions for 24 hours and then remove them after 24hrs.

Badge +5

You could use javascript to check a list item exists for that user.

First I had to get SPServices for jQuery.

NWF$ | The Chris Kent 

Then I added custom javascript to the form.

function check_for_recent_form(ListName) {
    var today = new Date();
    var diffMs = 0;
    var diffNarr = "";

    NWF$().SPServices({
        operation: "GetListItems",
        async: false,
        listName: ListName,
        CAMLViewFields: "<ViewFields><FieldRef Name='Created' /></ViewFields>",
        CAMLRowLimit: 1,
        CAMLQuery: "<Query><Where><And><Eq><FieldRef Name='Author' /><Value Type='User'><UserID /></Value></Eq><Geq><FieldRef Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'><Today OffsetDays='-1' /></Value></Geq></And></Where><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query>",
        completefunc: function (xData, Status) {
            NWF$(xData.responseXML).SPFilterNode("z:row").each(function() {
                var LastCreated = new Date(NWF$(this).attr("ows_Created").replace(" ","T"));
                diffMs = 86400000 - Math.abs(today - LastCreated); // milliseconds between now & LastCreated
                var diffDays = Math.floor(diffMs / 86400000); // days
                var diffHrs = Math.floor((diffMs % 86400000) / 3600000); // hours
                var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes
                if (diffDays > 0) {
                    diffNarr = diffNarr + diffDays + " days, ";
                }
                diffNarr = diffNarr + diffHrs + " hours, " + diffMins + " minutes";
            });
        }
    });
    if (diffMs == 0) {
        return 0;
    } else {
        return diffNarr;
    }
}

I then created a form variable to call the function upon load.  The calculation of the variable would be

check_for_recent_form({Common:ListName})

You can then use your form variable on formatting rule to show/hide a message or disable other controls.  Also, the function will return the number of hours and minutes until the user needs to wait until they can submit again.

Reply