Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
Locked
0

Allowing customers to submit Web App items without being logged in

Mentor ,
Mar 15, 2012 Mar 15, 2012

Using our Web Apps feature, you can easily allow customers to add their own dynamic Web App items. By default, however, customers are required to be logged in to a secure zone in order to submit their items.

With a little help from the handy jQuery framework, we can bypass this requirement - allowing visitors to anonymously submit new Web App items without the need for logging in to a secure zone.

Note: This guide assumes that you've already built a Web App with customer submitted items enabled - ready for inserting on a page. Find out more here.

Step 1. Create an anonymous user

To set this up, we'll need to create a "dummy" account that will be used each time a customer submits a new item.

createcontactbutton.png

Simply click Customers > Create new contact and create the customer, making sure to fill out the "Username" and "Password" fields.

For this example, we only need to enter in 3 fields - first up, we'll enter "Web App Submissions" as their first name.

1createcontact.png

Then enter "Anonymous" in the Username field, and "User" as the Password.

Click "Save & Finish" to save the contact details.

Step 2. Insert the Web App input form on your page

The next step is to insert our Web App input form on a page.

We'll create a new page and then navigate to Module Manager > Web Apps, and select "Web App Input Form for Customers".

2webappinsert.png

Select the Web App you've set up to accept customer submitted items and then click "Insert" to see the form inserted on the page.

Step 3. Include the JavaScript

Next up, we need to include the jQuery code on our page.

Switch over to HTML mode, then insert the following code inside the HEAD of your page:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

<script type="text/javascript">

$(document).ready(function() {

jQuery.post('/ZoneProcess.aspx?ZoneID=-1', { Username: 'Anonymous', Password: 'User' });

});

</script>

Note: In this sample code, we're referencing a version of jQuery hosted on the jQuery site. If you are hosting the jQuery .js library on your site, simply change the src= tag to reference your own copy of the file.

Note2: You will want to use this example in conjuction with your form. If you have a web submission on a page you can log the person in as they load the page or you can do so during the .submit() process.

Make sure to replace "Anonymous" and "User" with the username and password we assigned our "dummy" customer record earlier.


This script uses jQuery to automatically log the visitor in using your anonymous username and password upon page load. When they go to submit the Web App item submission form, they'll already be logged in to the anonymous account behind the scenes -meaning the form will submit successfully and they'll be taken to the confirmation / approval page.

If you have approval rules set up, you'll still receive notifications as per usual and be required to approve the new Web App item before it is visible on the front-end of the site.

Finally, save and publish the page.

TOPICS
Documentation
3.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2012 Jun 19, 2012

I'm totally bamboozeled by the WebApp for Input Form for Customers. Is there somewhere that I can go to find the steps for getting started?

Thanks,

John

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 19, 2012 Jun 19, 2012

Step by step instructions can be found here http://kb.worldsecuresystems.com/868/cpsid_86826.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 24, 2012 Jun 24, 2012

So I'm curious is there a way to setup the autoresponder when using this method?

I'd love to not need customers to login but I also require they get an email confirmation of their submission.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 25, 2012 Jun 25, 2012

Also what is the method for binding the login to the submit?

I tried the following in the checkWholeFormXXXXX function

theForm.submit(function() { jQuery.post('/ZoneProcess.aspx?ZoneID=-1', { Username: 'Anonymous', Password: 'User' }); return true; });

and in the form element

onsubmit="jQuery.post('/ZoneProcess.aspx?ZoneID=-1', { Username: 'Anonymous', Password: 'User' }); return checkWholeFormXXXXX(this)"

they dont seem to work.

It works fine in the (document).ready but this is not ideal for my purposes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 26, 2012 Jun 26, 2012

So I'm curious is there a way to setup the autoresponder when using this method?

I'd love to not need customers to login but I also require they get an email confirmation of their submission.

That's not possible. They're submitting items anonymously. If you want that you need to use this method http://kb.worldsecuresystems.com/868/cpsid_86826.html

As for your other post, I'm not too sure what you're trying to achieve there.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 26, 2012 Jun 26, 2012

mario_gudelj wrote:

As for your other post, I'm not too sure what you're trying to achieve there.

                        

In your OP you wrote:

Note2: You will want to use this example in conjuction with your form. If you have a web submission on a page you can log the person in as they load the page or you can do so during the.submit() process.

I was attempting to log the anonymous user in during the submit process rather than on page ready but I get an unauthorized access login screen when doing so. Perhaps the login post doen't have time to complete before the form is submitted?

Logging in on submit would prevent it from interfering with other logins but perhaps some logic to check if there is already a user logged in would be more appropriate does the whoisloggedin module support this check?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 26, 2012 Jun 26, 2012

There's a module called {module_isloggedin} that rendered 1 or 0, which you can use in your JS to verify that.

Cheers,

-m

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 26, 2012 Jul 26, 2012

Have just come across a potential bug with this method.

It seems to require a page be loaded again before the log in is recognised. For example I have the login script on my webapp submission page, if I fill out the form and submit it the first time I navigate to the page I get an unauthorized access error.

However, if I refresh the page then fill out the form it works fine? It also works if I have navigated to other pages on the site.

Also If i navigate from a page with the login script to a seperate section of the site (that has a whosloggedon module but no script for logging in anonymously) it says I am logged in as Web app submission, which I would expect.

Any ideas why this is happening, is my implementation perhaps incorrect?

http://www.mobistore.co.nz/index.html

Thanks

Tim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2012 Jul 27, 2012

Hi Tim, not got chance to look over your code but I have implemented this and expanded on it further and not had that problem.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 29, 2012 Jul 29, 2012

I didn't notice it for a while to replicate it I logged out, quit my browser started a new browsing session going directly to the forms URL and then submitted the form.

It works fine if I have loaded any other page or refreshed. I have several webapps using this method on the site and I have realised the linked page is the only one getting this error.

Only difference between this form and the others I can think of is that it requires payment. I'm using the offline payment gateway.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 30, 2012 Jul 30, 2012

I've bitten the bullet and rebuilt with a normal registration process its not ideal but safer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2012 Aug 15, 2012

Mario: Thanks for a good guide.

Question: Is there any way to log out in the background?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 15, 2012 Aug 15, 2012

Hi tmikaeld,

I'm not sure I understand that question. Please see if you can expand on it.

Thanks!

-mario

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 16, 2012 Aug 16, 2012

Hello Mario,

While logging in is good, that also means that if there is other secure zones on the page or even comments, the anonymous user would be able to post there.

So when the user leaves the webapp page, it should be logged out.

This is done by:

$.post('/LogOutProcess.aspx');

                        
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 16, 2012 Aug 16, 2012

Good one, tmikaeld.

Tom, yes you do. You need to create the CRM record, a username and a password, and subscribe this generic contact to a secure zone.

Cheers,

-mario

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 17, 2012 Aug 17, 2012

Yep. After the other events of course 🙂 good point 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 13, 2012 Oct 13, 2012

Hi:

Just getting my head wrapped around how to make this work, since I also have a website that relies on customers being able to log into other areas.  I was wondering, where on the page would I use the code "$.post('/LogOutProcess.aspx');" mentioned above - so that when people leave this page they won't continue to be logged in as the Anonymous person?  Although wouldn't this cause a problem for someone who was logged in as a valid user (previous customer who perhaps bought something)?

Which brings up another thought I had. I was not sure whether I am just not reading something right - but if I set up jQuery to allow people to be logged in Anonymously so they can send the WebApp - what happens with a customer who logged into the site as themselves (perhaps to order something) and then they come to this page and try to submit the form as themselves.  I find that the code will override their login - how do I use the {module_isloggedin} to validate that they are already logged into the system and leave them logged in so they can use other areas of the site afterward. 

Sorry if this is complicated, but I hope it is possible because the Web App feature has allowed me to create a really nice "Share your Experiences" page - but it hinders things if people have to be logged in to use it.

Thanks for any help!!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 28, 2013 Feb 28, 2013

Hi Tiffany,

I have the same issue with this automatic login. It is interfering with other logins. Did you find a solution for that issue?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 17, 2013 Jan 17, 2013

I could not really see where the script has to be placed in order to logout as the anaonymous user in this case. Can someone advise to a non script literate person exactly where this needs to be placed such that the person is logged out immediately after submitting the web app item as the anon user.

Thanks... Greg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 28, 2013 Feb 28, 2013

Has more to do with making sure you call jQuery and having an understanding of the script and what is going on. It is more then just copy and paste here as it is more then beginer stuff being shown here. You may have javascript errors, you may be not calling jQuery or more then once, conflicts, incorect implementation, not made the dummy user properly?

Without seeing things - hard to tell but you need to understand what is going on above to really be able to implement it properly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 16, 2012 Aug 16, 2012

Ive tried to set this up just like above but just keep getting auth errors - do i need to subscribe the person to a secured zone as well?


Tom

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 17, 2012 Aug 17, 2012

I did all that but still get the auth error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 19, 2012 Aug 19, 2012

Please provide the URL of the login form and the CRM id of the contact you are logging in and I'll take a look at this for you.

-m

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 20, 2012 Aug 20, 2012

Hi Tom,

Thanks for the PM. I've decided to post this hear to educate others who may experience a similar problem.

The way I approached this is to open the Chrome Console and look at the errors and Crome reported "Uncaught SyntaxError: Unexpected token ILLEGAL" on line line 133.

I looked at that line and I found this:

jQuery.post('/ZoneProcess.aspx?ZoneID=-1', { Username: 'anon', Password: '23wesdxc'' });

I immediately noticed that there is an extra ' around password.

But, I then pasted the line into a console and I got the same error message, so I neew that this was the problem.

I tehn removed it and then ran the same line again and I got the successful response.

anon-login.jpg

By the way you may want to look at some of the other errors on that page and fix the JS that's causing them.

I hope that helps!

-mario

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines