How to auto populate fields with user data using php in RSForm Pro

Today I'm looking at RSForm Pro. What we want to do is want to auto populate the fields with user data after they have logged in and are ready to fill out the form.

To do this we have to go to RSForm Pro in the back-end of Joomla and click manage my forms.

On the front end I have already created a menu link to an existing form. By default the email field is blank, but we want the users email to be filled in for them.
To do this we will go to the form in the backend, open manage forms, and then select the email text box.

In the default value we will add the following code:

$user = JFactory::getUser();
return $user->get('email');

This will automatically pull the users email and auto populate the form with it.

You can also easily pull the following data
• $user->get('id') = user id
• $user->get('username') = the username
• $user->get('name') = registration full name
• $user->get('email') = registration email

Hit save and check it on the front end.

Need more explanation? Watch the video.

How to automatically logout a user when they submit a form - RSForm Pro Joomla

This technique can be used on absolutely any form you want, but what we want to do is automatically log out the user after they submit a form. To do this we are using RSform Pro and the Quick Logout component in Joomla 2.5.

The first thing I’ve done is I downloaded and installed Quick Logout.

Now you’re going to create a new menu item. Just call it logout and link it to the menu item quick logout and the redirect page is going to be to our thank you page. To create your own thank-you page go into your content and create an article.

Now login to your webpage and find the URL to your logout menu item. You may have to login to see it.

Go to RS form Pro, manage forms, and pull up the form that you’re working on.

Under Properties, Form Info, set “Show Thank-you message” to no. This will also automatically remove the continue button.

Now enter in the URL of your logout menu in the “Return URL” field and save.

This will cause that when the form is submitted successfully, the user will be redirected to the logout link, which will automatically log the user out of the website, and then forward them to the thank-you page, or wherever else you want them to be forwarded to.

Still not making sense? Watch the tutorial video for a better understanding on how to automatically logout a user when they submit a form.

How to hide conditional fields in an RSForm Pro Email

Good morning, Merry Christmas and all that fun stuff!

Welcome to Richard Bankert Web Design Tutorials. Today we are looking at RSForm Pro and we had a question here: How do I make the Email to the Customer admin with different values? We were talking about conditional forms when this question was asked. So, I’m going to cover this topic. If you are looking for something different, then leave another comment below and we’ll make another tutorial on that.

So, in this tutorial what we are going to cover is, if you have conditional fields, how do you make them to show or not show, based on if they have values or not?

So, if I have an Email where I want to send something to.. let’s just get into it here and we’ll start. Let’s make a conditional field here, just to get things started. So, Newsletter sign up - No thanks, Subscribe, Unsubscribe. We chose Subscribe and we’re going to make a conditional field that will show up, if someone says: Subscribe. If you need to know how to do conditional fields, you can look at my tutorial on: “How to add multiple conditional fields in RSForm Pro”. I’ll put that link up here.

So, here we have this new condition. We now have the field, and I’m going to hit: Preview.

You can see we can say: No thanks, and that field goes away, so it’s conditional, based on what you choose. Now when we have our letter going out to say, the admin, what if we don’t want that Email to be in there? So, I’m just going to grab all of these… If someone from RSForm Pro is watching this, this needs to be changed. This is terrible, on the side here, it’s hard to work with. Everything else is pretty good, but this is hard to work with. So, I’m dragging all my values and I’m just going to put it in here.

So, right now we have all of our values into our Email and we also have this Tell us why caption. What this does is it allows us to have our Caption name and then the value in there.

What if we have a condition where the Email is going to someone, and if the condition is met, this information is supposed to be sent to user A, if the condition is not met, then we don’t want this value passed on, we want this value to just not be there at all. However, we only have certain amount of Emails that we can send out, so we want to specify what information gets sent which direction.

In our condition, we can say here… If this condition doesn't get filled out, that means if it’s blank, there’s nothing there at all, that means we can say something like this: if, then Space, now we have our Tell us why caption, we go to the end of it, we add another curly bracket, then I’m just going to clean that up, and then we’re going to put a curly bracket in the end, SLASH, if, closing bracket. So, what this does is: If this has a value, it will display it. If it does not have a value, then it won’t get displayed. One thing to know is this is starting with Revision Number 46, so if you have an older version of RSForm, you may have to upgrade in order to use this short-code, cause they added it about a year ago I guess. So, now when you send your Email, if there’s no value, it won’t get shown at all.

The other thing that you can do in here is: you can actually add text, so right in here I can say: I want to subscribe because… and then this. Everything within here doesn't get shown. So, you can actually use this to control various texts, as well as if someone selects something, and you can have information show up in your letter, that won’t show up if someone doesn't select that.

So, that’s a quick answer. I hope that’s what you were looking for. If you were looking for something else, please let me know and I will do another tutorial.

Thanks for visiting today and I hope you have a Merry Christmas!

Dont Miss Our Newsletter

I agree with the Terms and Conditions

Copyright © 2006-2018 Richard Bankert Web Design. All Rights Reserved. Post by Richard Bankert
111 Centennial Dr., Dauphin, Manitoba, R7N 2W8 - 204-648-4952 - This email address is being protected from spambots. You need JavaScript enabled to view it.

Richard Bankert Web Design is a Dauphin, Manitoba, Canada, Web Designer and a Web Design Company specializing in Web Design, Web Development,Content Management Solutions and E-Commerce using CMS solutions. Joomla! is a trademark of Open Source Matters. Richard Bankert Web Design is not affiliated with or endorsed by the Joomla! Project or its trademark owners.