6 Replies Latest reply on Jun 11, 2014 11:04 AM by topelovely

    How can I restrict multiple web app item submission by a user

    topelovely Level 4

      I have a webapp setup. I do want users to submitted web app items multiple times. How can I achieve this Kindly help. I know I only achieve this with js. Can someone kindly off.

        • 1. Re: How can I restrict multiple web app item submission by a user
          Chad - ChicagoDigital.com Level 1

          Hello topelovely,

          To restrict them to only one submission you can:

          You can set up a custom list view for the web app that just outputs the web app item counter for that user.

           

          Then have a hidden div with that module in a data attribute (or you can add it to your web app item div). It should output 1 for one item and 12 for two items and so on.

           

          Then with jQuery you can remove the web app form if that number is greater than 1

           

          Here is a js fiddle with an example of how I did it. Edit fiddle - JSFiddle

           

          Hope that isn't too confusing.

          Chad Smith

          • 2. Re: How can I restrict multiple web app item submission by a user
            topelovely Level 4

            Thanks so much Chad. Wish all BC evangelist can be supportive like you. I will study it and let you. Thanks once again.

            • 3. Re: How can I restrict multiple web app item submission by a user
              topelovely Level 4

              Hi Chad, I believe I can use the alternate list layout too. Instead of creating a custom template, right?

              • 4. Re: How can I restrict multiple web app item submission by a user
                topelovely Level 4

                Hi Chad, am having challenges getting this to work: Kindly assist

                 

                This is my setup:

                 

                I used the alternate list layout. This is how it looks

                Web Apps  Test   submit webappitem once.png

                 

                This is how my form page with the module looks before running:

                 

                Pages  bctest useradditem form  Live Page .png

                 

                 

                This is how the spit out looks when I checked:

                 

                This is the source code after running:

                 

                <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

                <script type="text/javascript">

                 

                 

                $(function(){

                 

                 

                var userSubmit = $('.userItems').data('items').replace(/\s+/g, '');

                if (userSubmit >= 1) {

                    $('.form').remove();

                 

                 

                });

                 

                 

                </script>

                <style>

                            .hide {

                            display: none;

                            }

                        </style>

                </head>

                <body>

                 

                 

                   

                        <div class="hide userItems" data-items="1

                2

                3

                "></div>

                        <div class="form">

                        <form name="catcustomcontentform17626" onsubmit="return checkWholeForm17626(this)" enctype="multipart/form-data" method="post" action="/CustomContentProcess.aspx?CCID=20247&amp;OID=13466153&amp;OTYPE=1">

                            <table class="webform" cellspacing="0" cellpadding="2" border="0">

                                <tbody>

                                    <tr>

                                        <td><label for="ItemName">Item Name</label><br />

                                        <input class="cat_textbox_small" type="text" name="ItemName" id="ItemName" maxlength="255" /> &bull;</td>

                                    </tr>

                                    <tr>

                                        <td><label for="ItemDescription">Item Description</label><br />

                                        <textarea name="ItemDescription" id="ItemDescription" cols="10" rows="4" class="cat_listbox"></textarea></td>

                                    </tr>

                                    <tr>

                                        <td><input class="cat_button" type="submit" value="Submit" id="catcustomcontentbutton" /></td>

                                    </tr>

                                </tbody>

                            </table>

                            <script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>

                            <script type="text/javascript">

                //<![CDATA[

                var submitcount17626 = 0;function checkWholeForm17626(theForm){var why = "";if (theForm.ItemName) why += isEmpty(theForm.ItemName.value, "Item Name");if (why != ""){alert(why);return false;}if(submitcount17626 == 0){submitcount17626++;theForm.submit();return false;}else{alert("Form submission is in progress.");return false;}}

                //]]>

                </script>

                        </form>

                        </div>

                • 5. Re: How can I restrict multiple web app item submission by a user
                  Chad - ChicagoDigital.com Level 1

                  Always happy to help. Can you provide a link to this test page, the code looks good but I need to see if there are any errors on the page.

                   

                  Thanks,

                  Chad Smith

                  • 6. Re: How can I restrict multiple web app item submission by a user
                    topelovely Level 4

                    Thanks Chad. But I used another method.

                     

                     

                    On Tue, Jun 10, 2014 at 11:41 PM, Chad - ChicagoDigital.com <