Forums

Auto populate fields

KayMontgomery 04 Jul, 2019
Hi there,

I am completely new to Chronoforms and feel like I'm going crazy 😛

I am trying to do two things in my form:

1. I need a field called "Name" which will automatically be populated with the name of the logged in user.
2. I have links to the form from various K2 articles on the site and need a field in my form to be automatically populated with the title of the article that is sending the user to the form.

I have looked at a number of posts here that want to do the same thing but it all just goes over my head. A lot of code is given which is great, but being a complete newby I dont even know what field type to use or where to put this code?

I realise its probably all very simple but if you could please post some screenshots (pictures are a great help) of exactly where to do this I would be so so grateful 🤗
healyhatman 04 Jul, 2019
1. {user:name}

2. Just include the id in the link. e.g. mysite.com/form?id=1 or mysite.com/index.php?option=com_chronoforms6&chronoform=formalias&id=1
Then retrieve the value in your form with {data:id}
GreyHead 04 Jul, 2019
Hi KayMontgomery,

To spell this out a bit more:

1: ChronoForms automatically adds some useful info to the form data set. If you set the value of the Name input to {user:name} it should fill that for you.

2: As healyhatman says, you can add the article ID to the calling URL, ChronoForms will add that to the form data and you can either include the id in the form data or use a Custom Code action to look up the form title from the id.

Bob
KayMontgomery 05 Jul, 2019
Thanks Bob, I think I understand point 1 but point 2 is still confusing?

"...you can add the article ID to the calling URL" - I dont know what you mean by calling URL? I'm guessing I would need to use the Custom Code option as I want the article title to be added automatically - there will be several different articles directing to the form.

Please can you be more detailed about how to do this? What field type do I use and where do I add this url? Do I use a a text field??
healyhatman 05 Jul, 2019
The URL you're adding to your article.
KayMontgomery 05 Jul, 2019
I'm sorry but that makes absolutely no sense at all - just looking at the forum posts it seems that it is designed for developers who understand php etc... why is it so hard to give me a detailed answer?

Your documentation gives lots of information about all the wonderful things Chronoforms can do but almost no information on HOW

"The URL you're adding to your article" doesnt explain anything....am I really just stupid??
healyhatman 05 Jul, 2019
You say you will have a link to the form in your article, right? That is what you said? THAT is where you put the article ID using the format I gave you.

Then in the form, you can use a read data action to get the article from #__content, which will include the name, using the URL parameter in the read data action's where condition. If you've done it the way I said, then you will use {data:id} in the where condition.
healyhatman 05 Jul, 2019
You can't rely on the referrer to give you the article ID especially if you're using SEF URLs , you need to put it in yourself to make sure.
KayMontgomery 05 Jul, 2019
Ok, yes I understand the concept of locating the article ID and that this is used by the form to identify the article. That makes perfect sense .

My problem is that you are replying to me as if I were a developer - you are using terms and language I dont understand. So I think this is where I am getting lost. This is why I have asked several times for screenshots - so I can see what you are meaning and will then understand in future. I realise that it is a bit much to ask.

Terms like "read data actions" and "where condition" for example mean nothing to me - I dont know what that is or where to find that in the form. They sound like something associated with SQL - and I dont know much about that.

Please understand that not everyone knows the technical terms you use. It may be simple to you because you work with this all the time. I understand that and appreciate that you know what you mean - but for someone who has never used Chronoforms before it is very confusing - its like a different language.

I can see that it is a very powerful form builder and would love to know how to use it properly.

Do you get what I mean?

I do appreciate very much that you are trying to help - I just honestly don't understand....
healyhatman 05 Jul, 2019
Read data action


Set to "First matching", with the WHERE CONDITION set up as described
KayMontgomery 05 Jul, 2019
Thank you - I appreciate that...

I dont have the same options that you do on the side menu in your screenshot...

I only have options for:

Fields, Advanced Fields, Security Fields, Areas, Widgets, Custom and Lists

No options for Database, Files, Joomla, Payments or Services

I tried to upload a screenshot but I get this message "Error saving the attachment file."

What am I missing? Is there something else I need to install to get these additional options?
healyhatman 05 Jul, 2019
Need to be in Actions instead of Views. See tabs on right of first screenshot.
KayMontgomery 05 Jul, 2019
HA! ok I see them now - had no idea the options changed like that 😮

Right, let me see if I can put this into practice and make some progress .

Thank you for your patience 🙂
This topic is locked and no more replies can be posted.