- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2017 05:41 AM
Can anyone please assist in converting the following into an alert using ${gs.getMessage('message');} so we can display translated values?
I highlighted in red the values I have messages for in the message table to substitute for.
Thanks in advance for the help!!
<script>
function checkMandatorySubmit(rec){
var storeUser = $[jvar_store_user];
if(storeUser)
gsftSubmit(rec);
var manFields = '';
var pcnum = $[jvar_pcnum];
var approver = $[jvar_approver];
var store = $[jvar_store];
var secapprover = $[jvar_approver2];
var location = gel('location').value;
var cube = gel('cube_number').value;
var proj = gel('project').value;
var art = gel('artemis_number').value;
var count = 0;
if(location == ''){
if(count > 0){
manFields += ', Office Location';
}
else{
manFields += 'Office Location';
}
count++;
}
if(pcnum == true){
var pc = gel('pc_tag_num').value;
if(pc == ''){
if(count > 0){
manFields += ', PC Tag #';
}
else{
manFields += 'PC Tag #';
}
count++;
}
}
if(approver == true){
var app = gel('approver').value;
if(app == ''){
if(count > 0){
manFields += ', Approver';
}
else{
manFields += 'Approver';
}
count++;
}
}
if(store == true){
var str = gel('store').value;
if(str == ''){
if(count > 0){
manFields += ', Store';
}
else{
manFields += 'Store';
}
count++;
}
}
if(secapprover == true){
var app2 = gel('approver2').value;
if(app2 == ''){
if(count > 0){
manFields += ', Second Approver';
}
else{
manFields += 'Second Approver';
}
count++;
}
}
if(proj == 'yes') {
if(art == ''){
if(count > 0){
manFields += ', Artemis #';
}
else{
manFields += 'Artemis #';
}
count++;
}
}
if(manFields == ''){
gsftSubmit(rec);
}
else{
alert('The following fields must be completed: ' + manFields);
return false;
}
}
</script>
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 06:09 AM
You have to remember that g:evaluate is done on the server, client scripts are done on the client and the Jelly stuff is all pre-processed first. Declaring a server variable cannot magically be used in a client script.
Try this:
if(art == ''){
if(count > 0){
manFields += ', '+='${artemis}';
}
else{
manFields += ' '+='${artemis}';
}
count++;
}
}
FWIW1: Whenever I see an if/else just to place a comma, my first instinct is to try and push all that information in to an array and then use join() to put the array in to a comma separated string. Far less code and keeping track of count variables to know if a comma is needed.
FWIW2: You might want to have a look at episodes 1-3 on all this stuff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 05:48 AM
One last piece of the puzzle... for the additional pieces of the message to tack on based on missing info I want to pull messages for those as well... starting with the artemis number one first I added it as a variable but then when I reference it later I think I am getting it wrong as well:
<g:evaluate>
var ManFieldMsg = gs.getMessage('mandfield');
var artemis = gs.getMessage('ArtemisNumber');
var office = gs.getMessage('Office Location');
</g:evaluate>
then referencing it in later:
if(proj == 'yes') {
if(art == ''){
if(count > 0){
manFields += ', '+=artemis;
}
else{
manFields += ' '+=artemis;
}
count++;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 06:09 AM
You have to remember that g:evaluate is done on the server, client scripts are done on the client and the Jelly stuff is all pre-processed first. Declaring a server variable cannot magically be used in a client script.
Try this:
if(art == ''){
if(count > 0){
manFields += ', '+='${artemis}';
}
else{
manFields += ' '+='${artemis}';
}
count++;
}
}
FWIW1: Whenever I see an if/else just to place a comma, my first instinct is to try and push all that information in to an array and then use join() to put the array in to a comma separated string. Far less code and keeping track of count variables to know if a comma is needed.
FWIW2: You might want to have a look at episodes 1-3 on all this stuff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 06:23 AM
BOOM! that worked!
thank you!
I'll research the other links as well...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 06:25 AM
Are we done yet.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thank you