Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Form Data to Array

More
2 years 9 months ago - 2 years 9 months ago #7923 by PhilSmithDHF
Form Data to Array was created by PhilSmithDHF
** UPDATE **
I now realise that I hadn't achieved what I wanted as I had thought that fieldlist would get me data for an entry rather than an item within an entry.

So can someone tell me whether I can access a specific name within a form.

Many thanks.

Phil

** END **

I'm an amateur trying to do things I've not done before ... so apologies ... and this is my first day with the full version of the software.

What I need to do is to take names out of a Form and put them into a php array where I can manipulate them.

I've almost done this but the method is pretty laborious so I'm wondering what's the best way?  Can I access the data from the Form directly ... and, if so, where can I find the form?

I've had a good look at the documentation and around this forum but haven't found what I'm looking for ... probably too basic!

Thanks.


Phil Smith
 
Last edit: 2 years 9 months ago by PhilSmithDHF.

More
2 years 9 months ago - 2 years 9 months ago #7925 by Administrator IV
Replied by Administrator IV on topic Form Data to Array
Hello Phil,

for me it is rather unclear at what you are aiming to finally achieve.
I have no idea what 'that fieldlist would get me data for an entry rather than an item within an entry' should tell me.

As the documentation states, the fieldlist shows all fields of a form, where each field defines a user control that is visible (in most cases) to the end user in the running form.
You can see/find the 'data for an entry' and also the data for all entries in both, the Joomla backend (administration) and the frontend (user).
But the Visforms documentation tells you all this already.

Responding to 'What I need to do is to take names out of a Form and put them into a php array where I can manipulate them':
You put data into a PHP array in PHP code, so I do now assume, that you like to have your own PHP code running in order to do what ever you like to do with the form data that was just send to the backend - this is where you want your own code to be executed.

And this is possible with Visforms via a feature called 'custom plugin'.
And it is even no big deal, assuming that you acquired some decent development experience, especially in the context of the Joomla platform framework would be helpful.
In short, you create a really simple Joomla plugin that gets loaded and may react to a variety of specific Visforms form events and you can achieve almost everything programatically, including
- putting the just submitted from data in a PHP array and manipulate them even before actually saved to the database
- access all the data that is already saved into the visforms data tables and else where
- and everything else ...

Documentation goes here:
Including the basic steps to create your own custom plugin:
www.vi-solutions.de/en/documentations/vi...ustom-submit-handler
All supported form events to react on:
www.vi-solutions.de/en/documentations/vi...loper-feature-events

Hope this helps, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 2 years 9 months ago by Administrator IV.

More
2 years 9 months ago #7926 by PhilSmithDHF
Replied by PhilSmithDHF on topic Form Data to Array
Ingmar

Thanks very much for your help.

To answer your question, I'm trying to arrange random groups of sportspeople for those who say that they wish to be involved on a particular day.

I can assure you that I have looked carefully at your documentation ... but obviously not carefully enough. I think that statements along the lines of putting data into articles led me down the wrong path.

I can use your plugin, of course but it would be just as easy to create my own form, I think.

Finally, just to be sure, I assume that I cannot put a single name into an article in any other way?

Once again, many thanks.


Phil

More
2 years 9 months ago - 2 years 9 months ago #7931 by Administrator IV
Replied by Administrator IV on topic Form Data to Array
Phil,

apart from the raw form creation itself, there are many also necessary and in some cases important related things to address.
Things like form and field security, data saving, data rendering in the front-end, dynamic reloading of sibling form fields after selection changes, design changes after changing the CSS framework, email sending, email address depending on user-selection, PDF creation, PDF emailing, double opt-in ... and so forth.

This is what you get out-of-the-box by choosing Visforms over implementing a form by yourself.
I personally would mind implementing things that are already implemented, tested and highly used by others and as a result providing high quality and stability.
But of course, all depends deeply ... if there were time and motivation to implement it, why not!

It is possible to show submitted form data in an article.
You have total control over the amount of data, the amount of fields and the amount of surrounding labeling.
It is possible to only show a single field content (e.g. name) of a single record in an article:
www.vi-solutions.de/en/documentations/vi...umentation-data-view
www.vi-solutions.de/en/documentations/vi...play-data-in-article

You're welcome!

Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 2 years 9 months ago by Administrator IV.

More
2 years 9 months ago #7938 by PhilSmithDHF
Replied by PhilSmithDHF on topic Form Data to Array
Ingmar

Thanks again for your help. I completely accept all of the points you are making but I do need to get the data I need.

I'm finding the articles you mention quite difficult, I'm afraid: perhaps they could do with an example?

What I'm still missing, though, is a {vfdataview} instruction that will give me data from just one form that has been completed. Specific data from all forms is not what I need.

Does such a thing exist?

Thanks again.


Phil

More
2 years 9 months ago - 2 years 9 months ago #7947 by Administrator IV
Replied by Administrator IV on topic Form Data to Array
Hello Phil,

the writing of the plugin string {vfdataview} is more or less a development task, at least like writing HTML or CSS.
The internal part (text between opening {vfdataview} and closing {/vfdataview} tag) of the plugin string is commonly known as JSON.
And you have to know the Visforms table structure to a certain degree (form IDs, field IDs and so forth).

Here is the plugin string of a tiny article that only shows a short static text
('Test article showing the logged-in user own form submit first name:')
and the value of the field 'first name' (field id 62) of the form (form id 10) that the logged in user submitted
('user1').

{vfdataview}{"formid":"10","fieldlist":"62","show_page_heading":"false","showlabel":"false"}{/vfdataview}

vi-solutions.de/forum-uploads/content-pl...a-view-example-1.png

The tiny data list in this case only contains 1 field of 1 record, showing no page header, no field label - only the name.
The data list, even a tiny one, is always a HTML table structure; due to the fact that it is meant and build to show large amount of data with filter search and pagination features.

In order to control the layout in detail you might have to be able to write some custom CSS in Visforms:
Dashboard --> Edit CSS
Here you create a new file that must have 'custom' in its name (like 'custom-data.css') and fill it with your own custom CSS as you wish.
The custom CSS file gets then loaded automatically by Visforms and is present in the page in the frontend.

I used this small CSS to have the name placed directly under the static text:
#plg-vfdataview-list-container0 .visdatatable {
  display: inline;
}

Where the '0' in 'plg-vfdataview-list-container0' simply counts the occurrence of any plugin string {vfdataview} in the article.
Multiple plugin strings are possible.

In order to have only the data of the logged in user selected and shown in the frontend you have to configure the form:
Form configuration tab 'Dataview in Frontend', parameter 'Own Data only' = 'Yes'

In order to have for each registered user only one data record you have to configure an appropriate field, like the email which should be unique:
Field configuration tab 'Advanced', parameter 'Unique Values Only' = 'Yes'.
Subsequent form submits of the same registered user only update the one and only record in the form data table.

Best regards, Ingmar

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 2 years 9 months ago by Administrator IV.

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum