show_error improvement

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
rprevost
Veteran Member
Posts: 34
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: 519
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: 1021
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: Mass Update plugin: Update multiple records at once and improve your workflow efficiency.

:arrow: Summary Reports plugin: Build powerful reports and charts for your AppGini apps.

:arrow: Search Page Maker: Compose user-friendly yet powerful search pages for your AppGini apps.

Post Reply