Copy link to clipboard
Copied
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.
To set this up, we'll need to create a "dummy" account that will be used each time a customer submits a new item.
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.
Then enter "Anonymous" in the Username field, and "User" as the Password.
Click "Save & Finish" to save the contact details.
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".
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.
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Step by step instructions can be found here http://kb.worldsecuresystems.com/868/cpsid_86826.html
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
There's a module called {module_isloggedin} that rendered 1 or 0, which you can use in your JS to verify that.
Cheers,
-m
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I've bitten the bullet and rebuilt with a normal registration process its not ideal but safer.
Copy link to clipboard
Copied
Mario: Thanks for a good guide.
Question: Is there any way to log out in the background?
Copy link to clipboard
Copied
Hi tmikaeld,
I'm not sure I understand that question. Please see if you can expand on it.
Thanks!
-mario
Copy link to clipboard
Copied
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');
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Yep. After the other events of course 🙂 good point 🙂
Copy link to clipboard
Copied
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!!!
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I did all that but still get the auth error.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now