How to Pass the Value from Widget Controller to On-load Script to set it to Variable field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
I am trying to create a spModal + Widget.
Where if I click Submit, it will pass the value from controller into on-load script to set it to the variable field.
HTML code:
<div>
<label>Select Mailbox Type</label>
<select ng-model="c.selected">
<option value="(On-Prem)">CUI User (On-Prem)</option>
<option value="O365">Non-CUI User (O365)</option>
</select>
<br><br>
<button class="btn btn-primary" ng-click="c.submit()">Submit</button>
</div>
Controller:
api.controller = function() {
var c = this;
c.selected = '';
c.submit = function() {
if (!c.selected) {
alert('Please select a value');
return;
}
alert(c.selected);
c.close(c.selected); // ✅ pass string back
};
};
Onload:
function onLoad() {
var cui_value = g_form.getValue('cui_mailbox_location');
spModal.open({
widget: 'widget_variable',
backdrop: 'static',
buttons: [],
}).then(function(result) {
alert(result);
if (result) {
setTimeout(function() {
g_form.setValue('cui_mailbox_location', result);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Ankur,
My business requirement here is that.
A pop up will appear to a CUI Manager to be able to select which mailbox does the user be created.
CUI Manager - will select then by clicking the submit set the value to the variable field 'cui_mailbox_location'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
the reason why i use onload is because i have also IF condition that the pop up will appear only to cui manager + state of the request.