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: 47
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

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: show_error improvement

Post by pbottcher » 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.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
a.gneady
Site Admin
Posts: 1281
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: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply