Joomla 5 Mitteilung

Wir freuen uns mitteilen zu können, dass seit dem 29. Januar 2024 alle unsere Joomla Erweiterungen mit Joomla 5 kompatible sind.

Für alle die gerade noch von Joomla 3 auf 4 aktualisieren: Anleitungen für die Joomla 4 Migration gibt es hier:

Es gibt nun auch eine eigenständige Dokumentation für Visforms für Joomla 4 und für Visforms auf Joomla 5

Forum

Visforms Subscription Inhaber können in unserem Forum Fragen stellen. Bitte mit dem entsprechenden Benutzer anmelden.
Jeder kann lesend auf das Forum zugreifen.

Bitte stellen Sie nur 1 Frage pro Thema.

Wichtig Angaben für fast jede Frage:
V1: Welche Visforms-Version läuft?
V2: Welche Joomla-Version läuft?
V3: Welche PHP-Version läuft?

Aufgrund von Feiertagen und Urlaub ist bei Anfragen im Forum in der Zeit vom 20. Dezember 2024 bis zum 8.Januar 2025 mit verlängerten Antwortzeiten zu rechnen.

pre-complete form fileds using form weblink

Mehr
10 Jahre 3 Monate her #792 von Ardkorian
pre-complete form fileds using form weblink wurde erstellt von Ardkorian
Is it possible to pre-fill out certain form fields using the http link to the form page.

we have a price box that we want to complete, and we want to send a link to the user for them to follow so theycan fill out their forms with their individual price already completed.

e.g

website.com/index.php/forms?price=450/

form:

name: <blank>
event: <blank>
price: 450 <----pre filled form based on info in link above

I am new to php and joomla forms, and don't fully understand the syntax required to achieve this if it is possible.

Mehr
10 Jahre 3 Monate her #793 von Administrator AV
Administrator AV antwortete auf pre-complete form fileds using form weblink
Hi,

in order to make forms as save as possible, I decided on not using url parameter in the way you request it. It's not very difficult for anybody to change the price in your example, is it? So no, that is not possible, there would be no right syntax at all.

I would like to understand why you think you need to pass the price parameter through the url? Where would the price value come from in the first place? What exactly do you want to accomplish?

Regards,
Aicha

: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 :-).

Mehr
10 Jahre 3 Monate her #794 von Ardkorian
Our forms will be hidden, and only people that we direct to the forms using the link would use them.

Majority of our users will not be tech savvy, and wil follow the link we give them.

We will have already agreed a price via email or phone when they first contact us, so rather than doing 100s of different forms with £10 increments, we want 1 form, that we can link to with the price passed from the url.

The form will also do a calculation on the price submitted to tell the user what their deposit and final balance is.

There would be no advantage for the user to amend the price as we would already have a record of the quote.

This form is for user information only. And not as a shopping cart.

Thanks

Mehr
10 Jahre 3 Monate her #795 von Administrator AV
Administrator AV antwortete auf pre-complete form fileds using form weblink
Hi,

thanks for the details information.
Actually that is quite a specific use case and not possible with Visforms out of the box, but I think it's possible to realize.
If I had to extend Visforms for a client with your feature I would not try to interfere with the core code of Visforms (php) but use Javascript, because there would be quite a lot of php code to be changed and you would have to maintain those changes individually with every update of Visforms.

I woud try to place the Javascript inside the index.php of the template and not in Visforms files to prevent it from being overridden by updates of Visforms.

You can add any parameters to the Url that calls the form. The parameters are not cut away our such things. So the Url you send to your clients would look something like

yourJoomlaWebsite/index.php?option=com_visforms&id=1&field1=450

where id is the form's id and field1 is your price field
Please do not link the form to a menu item, because this would cause the SEO router to convert option=com_visforms&id=1 into a SEO url.

The input of every form field (which is represented by an HTML input) has a specific id which is composed from the string "field" and the field's id (which you can find in the id column of the fields view in backend). (So This will not work for radios or selects but I think that is of no concern to you).

Essentially you have to write some Javascript code to get the Url parameter. If you are on Joomla! 3 you could preferrably use jQuery which is already part of the Joomla! core but must of course be included in the template. If you are on Joomla! 2.5 using jQuery may cause problems so you could use just Javascript without a framework like jQuery.

The following Javascript function should do the trick without jQuery but of course I have not tested it on many browsers
Code:
function getArg(name) { var args = new Object(); var query = location.search.substring(1); var pairs = query.split("&"); number_of_arguments = pairs.length; for (var i=0; i<number_of_arguments; i++){ var pos = pairs[i].indexOf('='); if (pos == -1){ continue; } var argname = pairs[i].substring(0,pos); var value = pairs[i].substring(pos+1); args[argname] = unescape(value); } if (args[name]){ return args[name]; } else { return null; } }

You can use some code similar to the following one, to set the parameter value from url as input value
Code:
var field1value = getArg('field1'); var field1 = document.getElementById("field1"); field1.value = field1value;

Of course you have to make sure, that you only run the code when you display the form and that the field is available and so on, but you can use the getArg() function to check if the url contains the option=com_visforms and the id=1

I just outlined the principles of the solution here, not a fully developed and tested solution. I hope you have some coding skills and can transform the sketch into working code following my instructions.

If you have further questions, feel free to ask.

Regards,
Aicha

: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 :-).

Moderatoren: Administrator AVAdministrator IV
Powered by Kunena Forum