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.

Error message in Default Joomla "system-message"

Mehr
7 Jahre 8 Monate her #3500 von ttome
Hi, all!
I have no idea how to fix my problem! :(
May be some one can help me...

So, i have Yootheme, with default Uikit Modal component . The same time i using free Regular Labs plugin Modules Anywhere . So i can put my Visform module into modal. It's work great with form sending, but i found a small problem with Error message!..

When i using "Upload file" input with custom settings (for example: file format must be only png) i get an Error message when trying to upload file in jpg. This is all good, but i get this message in my modal, NOT IN Default Joomla! System Message Container!

So i found this code:
Code:
<?php if (isset($visforms->errors) && is_array($visforms->errors) && count($visforms->errors) > 0) { $layout = new JLayoutFile('visforms.error.messageblock', null); $layout->setOptions(array('component' => 'com_visforms')); $html = $layout->render(array('errormessages' => $visforms->errors, 'context' => 'form')); echo $html; } ?>

It displays next code in my Form block:
Code:
<div class="alert alert-danger"> <button class="close" data-dismiss="alert" type="button">×</button> <h4 class="alert-heading">Title</h4> <p>Text.</p> </div>

Now I break my head HOW TO replace this message into Default Joomla! System Message Container??? :S

PS
Sorry for my English

Thank You

Mehr
7 Jahre 8 Monate her #3501 von Administrator AV
Administrator AV antwortete auf Error message in Default Joomla "system-message"
Hi,

Visforms can be used with a module, displayed inside an article or published via a menu item and it is actually possible to have multiple forms on one page and you can display a form in a modal window using the component.php ( www.vi-solutions.de/en/documentations/vi...rm-in-a-modal-window ) which is a common way in Joomla! to only display the component. If the server side form validation fails and you have used any of the ways to display the form, the form will be displayed again and the user inputs, which were already made, are used inside the form. Further on, Visforms displays error messages then.

I decided on displaying the error messages inside the form, using the standard Joomla! HTML tags and classes as for the system message, in order to make sure, that the error messages are always displayed and are always near the form (with component.php in a modal window, the messages would not be visible and with multiple forms on one site, it could be confusing, if the message are apart from the form).

Nevertheless, the error messages are created by a Visforms layout file, which can be overriden in your template. The layout file - messageblock.php - is located at components\com_visforms\layouts\visforms\error. Create a copy of this file in templates\yourTemplate\html\layouts\com_visforms\visforms\error

Replace the following code from the override file
Code:
$html .= '<div class="alert alert-danger">'; $html .= '<button class="close" data-dismiss="alert" type="button">×</button>'; if (!empty($displayData['context'])) { switch($displayData['context']) { case 'dataeditform': $html .= '<h4 class="alert-heading">' . JText::_('COM_VISFORMS_EDIT_FORM_HAS_ERROR') . '</h4>'; break; default: $html .= '<h4 class="alert-heading">' . JText::_('COM_VISFORMS_FORM_HAS_ERROR') . '</h4>'; break; } } else { $html .= '<h4 class="alert-heading">' . JText::_('COM_VISFORMS_FORM_HAS_ERROR') . '</h4>'; }
with
Code:
$app = JFactory::getApplication();

In the foreach statement replace
Code:
$html .= '<p>' . $errormessage . '</p>';
with
Code:
$app->enqueueMessage($errormessage, 'error);
delete the line
Code:
$html .= '</div>';

I think this is roughly what you want to do.

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