Event Switcher -> Validation -> Error display

monochrome 01 Dec, 2014
Hi,
i set up a Event Switcher with an Event Loop inside the fail state. Now i want to display an error when this state is fired.

I tried it with

$form->validation_errors['myfieldname'] = "Message";


inside the Event Switcher.

The Debug Error Status stays empty. (Everything else working fine!) ( I aso tried it with custom code inside "fail" state)

Can you give me a hint what i´m doing wrong?

I just want to display an error message ( Best next to the field) inside an Event Switcher.

Thanks in advance,
Thorsten
monochrome 01 Dec, 2014
Hi,

i found a solution to post an error message at the top, but not next to the regarding field with:

$form->errors[''] = 'My error message';


Is there a way to post it to the regarding field? ( Or even better : Use the gtooltip ...)

Any hints to achieve this would be nice!

Thorsten
Max_admin 01 Dec, 2014
1 Likes
Hi Thorsten,

Unfortunately this is not easily possible now, maybe the next update can solve this issue since it has an easy way to call the gtooltip!

regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
monochrome 02 Dec, 2014
Answer
Hi Max,

thanks for your answer and information!

I solved it through a quick&dirty workaround (Maybe someone needs this solution too):

1. i added a Load Javascript into the "on fail" Event before the Event Loop

2. I added this code

jQuery(function($) {

var position_input =$( "#your_wrapping_div" ).position();
var height_input=$( "#your_wrapping_div").outerHeight();
var width_input=$( "#your_wrapping_div").outerWidth();

var computed_height =  (position_input.top - height_input);
var computed_width =  width_input / 2;

$( "#Id_of_your_input_field" ).addClass("gvalidate_has_errors");
$( "#your_wrapping_div" ).append("<div class=\"gtooltip gvalidation-error-tip\" style=\"top:" +computed_height+"px \; left: "+computed_width+"px\;\"><div class=\"gtooltip-close\">×</div><div class=\"gtooltip-content\"><span class=\"gvalidation-error-text\">Your error message</span></div><div class=\"gtooltip-arrow-border gtooltip-arrow-border-top\"></div><div class=\"gtooltip-arrow gtooltip-arrow-top\"></div></div>");

});


The positioning is not perfec but work ok with responsive ... Maybe ill add a better solution later.

Hope this helps someone!

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