File Download Form ?

entumas 23 Oct, 2017
Hi guys!

It would be possible to make a form that when doing Submit this form save the username and e-mail of the user in a proper table, and once sent the form automatically start downloading a file?

Thanks!🙂
GreyHead 24 Oct, 2017
Hi entumas ,

Yes, that is possible, you can save the User ID - or lookup and save the username and email (saving just the ID is usually better). You can use a Download action to download a file - this has to be the last action in the On Submit event.

Bob
entumas 24 Oct, 2017
Thanks Bob!

Do you have any tutorial or article in the blog to see how to save the info in the database?

Thanks again.
GreyHead 24 Oct, 2017
1 Likes
Hi entumas ,

You use the DB Save action in the form On Submit event. It is straightforward to use. This video may help.

Bob
entumas 25 Oct, 2017
Hi Bob!

Yes, yesterday after writing I was messing a bit and it is relatively intuitive.
But I can't do everything I want

My website is for registered users only, with this in mind:

1. I want (apart from other data) to be stored in the database the username, email and its id in Joomla!

2. I want that if someone uses this form again, they update the data in the same row of the user and not that a new row is created (as it happens to me now)

3. I would like in one of the columns called "downloads" save information type array that includes 3 values: Object downloaded, version of the object, amount of downloads made of that object

Thanks!
GreyHead 25 Oct, 2017
HI entumas,

1. Look up the user info and add it to the $form->data array Please see this FAQ

2. Please see this FAQ

3. If you can get the data you can convert it to a string - json-encoding works well and save the result to the database along with the other form data.

Bob
entumas 25 Oct, 2017
Hi Bob!

I managed to solve point 1 without problem.

But I do not get results with point 2.
I had already looked at this FAQ that you sent me yesterday, but this is for CF4, and the interface does not match.
Can you help me fix this?

Thanks!
GreyHead 26 Oct, 2017
Hi entumas,

The differences between CFv4 and v5 here are fairly small. Which bit is causing you problems?

Bob
entumas 26 Oct, 2017
Hi Bob

The steps to follow, I don't know what it means.

In the image for example, only 3 fields appear. In CF5 there are many more fields, and I am not able to see the equivalence between them.

Thanks.
entumas 26 Oct, 2017
Bob, How can I pass data from one 'custom code' to another?
I have a 'custom code' in the 'On load' event and two in the 'On submit' event
I would like to share data between them

Thanks
GreyHead 26 Oct, 2017
Hi entumas,

You can add the data to the form in hidden inputs, OR you can use the 'Data to Session' and 'Session to Data' actions to save it to the Joomla! User session; OR if you are loading it from a table then you could re-load it after the form submits.

Bob
entumas 27 Oct, 2017
Can I have 2 forms on the same page?
GreyHead 27 Oct, 2017
Hi entumas,

Yes, but make sure that they have different form and element names to avoid confusion, and there may be some problem with using two Google Captchas on the same page.

Bob
entumas 28 Oct, 2017
Hi Bob


My form opens in a modal window. The sending is done by AJAX, to show the response in the modal without reloading the page. So far so good.

The problem I have when I want to reopen the modal/form without reloading the page. The modal shows me the answer.

How can I return/refresh to the form without reloading the page?


Thanks!
GreyHead 29 Oct, 2017
Hi entumas ,

I'm not clear what you need to do here . . . if it is to reload the form after it is submitted then you can use an Event Loop as the last action in the On Submit event.

Bob
entumas 30 Oct, 2017
Hi Bob

Event Loop as the last action in the On Submit event?
Could you explain a little more, please?

I want the form to be reloaded when the user presses the "close" button that appears in "Display message", after submitting the form. This button is the one that closes the modal window now.
So when the user reopens the modal, the form appears again.

Thanks
GreyHead 30 Oct, 2017
Hi entumas ,

I've no idea - if you are showing the form in a Modal Window then closing the window and then re-opening it should re-load the form - unless you have caching enabled, I guess in that case it might load a cached version of the final page.

Bob
This topic is locked and no more replies can be posted.