show_error improvement

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
rprevost
Posts: 24
Joined: 2018-05-30 22:09

show_error improvement

Post by rprevost » 2018-10-09 00:25

Hello to you all,

The show_error function used in field content validation javascript is great.
However, the title of the modal window is sometimes "cryptic" especially if the name of the database name of the field looks like "sta_form_start_date". Since the caption of the field is nicer "Student Class Start Date", I wonder if it is possible to display the field caption instead of the field name in the show_error title.
I think that ergonomy of the tool would be greatly improved for end users.
I did not succeed in doing this (where is the list of methods and functions for fields?)
=====================================
function show_error(field, msg){
modal_window({
message: '<div class="alert alert-danger">' + msg + '</div>',
title: 'Error in ' + field,
close: function(){
$j('#' + field).focus();
$j('#' + field).parents('.form-group').addClass('has-error');
}
});
================================
Best regards,
RP

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 378
Joined: 2018-04-01 10:12

Re: show_error improvement

Post by pböttcher » 2018-10-09 06:34

Hi,

how do you call the function? The field variable is holding your titel, so if you pass the caption (which is the label) you should be fine.

User avatar
a.gneady
Site Admin
Posts: 992
Joined: 2012-09-27 14:46
Contact:

Re: show_error improvement

Post by a.gneady » 2018-10-11 13:54

If I understand correctly, you wish to retrieve the field caption given the field name to pass to the title of the modal .. Here you go:

Code: Select all

title: 'Error in ' + $j('#' + field).parents('.form-group').find('label').text(),
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

:arrow: Summary Reports plugin enables you to build powerful reports and charts inside your AppGini application through a few simple steps. See the big picture and discover trends in your data that empower you to take the right decisions confidently.

:arrow: Search Page Maker enables you to build user-friendly yet powerful search pages for your AppGini application by simply dragging and dropping the fields you want to include in search.

Post Reply