- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2024 07:00 AM
Hello everyone,
I've encountered this problem while trying to troubleshoot a custom button on a workspace page, the architecture is as follows:
- UI Action opens a Modal from workspace code section
- the Modal displays a UI Page
- this UI Page calls through GlideAjax a script include function when the button is pressed
- once pressed, the ui page clears and displays the return value of the previously mentioned script include function
I've dumbed down the code to the bare minimum to see exactly what it is that's not working but, at last, nothing. If anyone has any ideas please help.
The UI Action:
function onClick(g_form) {
g_modal.showFrame({
title: getMessage("Nuovo Cliente?"),
url: 'add_consumer_modal.do',
size: 'lg',
autoCloseOn: 'URL_CHANGED'
});
}
The UI Page:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="iframeHelper.jsdbx"></g:requires>
<style>
.newCustomerStyle div{
margin-top: 1rem;
}
.newCustomerStyle{
margin-top: -1rem;
}
.newCustomerStyle2{
margin-top: 1rem;
display: flex;
justify-content: right;
margin-right: 1rem;
}
</style>
<body>
<div class="mb-3">
<label for="FormControlInput" class="form-label">Codice fiscale del chiamante</label>
<input type="text" class="form-control" id="codiceFiscale"></input> //not used right now
<div class="newCustomerStyle2">
<button type="button" class="btn btn-primary" onClick="findAnagrafica()">Cerca</button>
</div>
</div>
</body>
</j:jelly>
and its Client Script:
function findAnagrafica() {
document.write('prova ');
var ga = new GlideAjax('createNewConsumer');
ga.addParam('sysparam_name', 'createConsumer');
ga.getXMLAnswer(getResponse);
function getResponse(response) {
document.write(response);
}
}
The Script Include:
var createNewConsumer = Class.create();
createNewConsumer.prototype = Object.extendsObject(AbstractAjaxProcessor, {
createConsumer: function() {
ret = '42';
return ret;
},
type: 'createNewConsumer'
});
The Result
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 06:01 PM - edited 04-09-2024 06:29 PM
It's an easy mistake to make (I've done it myself before), but it should be sysparm_name not sysparam_name:
ga.addParam('sysparm_name', 'createConsumer'); // removed "sysparam_name", replaced with "sysparm_name"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 06:01 PM - edited 04-09-2024 06:29 PM
It's an easy mistake to make (I've done it myself before), but it should be sysparm_name not sysparam_name:
ga.addParam('sysparm_name', 'createConsumer'); // removed "sysparam_name", replaced with "sysparm_name"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2024 01:57 AM
Truly a programming moment.
Thanks a lot!!