How to save the field values from Popup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 04:50 AM
Hi All,
Having a Requester catalog form to raising a incident ,when a requester doesn't have Timezone , timezone field popup window should display and if we select any timezone that timezone values should be save in "sys_user" table.
I am getting popup field but if i have select any values, that value doesn't saving in "sys_user" table. Below code i have written.
Catalog client script:-
----------------------------
function onSubmit()
{
//Type appropriate comment here, and begin script below
var time;
var requested_for = g_form.getReference('caller_id');
time = requested_for.time_zone;
//alert(time);
if(time)
{
return true;
}
else
{
alert('your timezone is empty please fill the appropriate timezone');
var dialog = new GlideDialogWindow("Timezone");
dialog.setSize(700,400);
dialog.setTitle("Select the user time zone:");
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue("u_comments", comments);
g_form.save();
dialog.render(); //Open the dialog
//var tz = gel("ddlTypes").value;
//alert(tz);
return false;
}
}
UI Page:-
HTML:-
--------
Ui Page client script:-
Can any one help me where i have done mistake.
Thanks In Advance,
Immanuel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 05:15 AM
Hi you need to do following changes in your UI Page
1. In HTML
<input type="hidden" name="cancelEvent" id="cancelEvent" value="" />
.
.
.
.
<g:dialog_buttons_ok_cancel ok="return validateForm();" cancel="return cancelMe();" />
2. In Client Script.
function cancelMe(){
$('cancelEvent').setValue("1");
}
3. In Processing script
if(cancelEvent == "1"){
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
}else{
// write Your code here
var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 11:25 PM
Hi,
Have you write validateForm() function in your client script.
and also get your variable value in Processing script by variable name
like
<select name = "add1type" id = "add1type">
<option value="India">India</option>
</selcect>
function validateForm(){
var add1type = $('add1type').getValue().trim();
if(add1type == ""){
alert("Please select");
$('add1type').focus();
return false;
}
}
You will get add1type in your processing script directly . I have no idea about your variable.caller_id. so comment your query and check your logs using below cobe.
gs.log(" == "+add1type); // check in log