Change label, show * for mandatory

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Change label, show * for mandatory

Post by pfrumkin » 2020-06-25 20:39

I have need to dynamically change label for a text field. The Label method (https://appgini.bizzworxx.de/products/j ... ew/labels/) works well. However, this happens to be a required field, so the html has <span class="text-danger"><%%TRANSLATION(*)%%></span> for the label to present the * mandatory indicator. How can I get that * displayed after using the Label method?

I have updated the tablename_templateDV.html file to add an id for the label, then I manually append the html to the label in the tablename-dv.js file. I don't like this because I have to set this to Read Only so I don't overwrite it every time I regen. I don't like having to do that because eventually I will need to change that template and my changes won't take (because I will forget that it's Read Only).

Any ideas?

TIA

~Paul

AppGini 5.82 revision 1101

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Change label, show * for mandatory

Post by jsetzer » 2020-06-25 20:54

Code: Select all

var fieldname = "type_id"; // change this
new AppGiniField(fieldname).label("my new label");
$j("label[for=" + fieldname + "]").append("<span class=\"text-danger\">*</span>");
chrome_6LjKtoLgbS.png
chrome_6LjKtoLgbS.png (1.56 KiB) Viewed 1549 times
Regards,
Jan

PS: In next version it will be just enough to call the .label("caption") function which will automatically keep the red required-*. It will also automatically care for keeping the blue info-bubble if there is a field description.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Change label, show * for mandatory

Post by pfrumkin » 2020-06-26 17:02

Awesome, works like a champ! Thanks Jan!

Future sounds great too.

~Paul

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

SOLVED: Change label, show * for mandatory

Post by jsetzer » 2020-07-08 05:19

Thanks, Paul, I'm happy it works for you!
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Post Reply