how to set the value of the Choice type field based on the function for form UI button?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 01:01 AM
What i wanted to do is when i click the accept button the choice type field from new to in progress
example:
the choice selected after i create new record is State=New when i click the Accept button the state will change to in progress( State=In Progress)
this is my code
function ProgressIncident(){
//Set the 'Incident state' and 'State' values to 'In Progress', and display mandatory fields
g_form.setValue('incident_state', 2);
g_form.setValue('state', 2);
g_form.setValue('inprogress_by', g_user.userID);
gsftSubmit(null, g_form.getFormElement(), 'inprogress_incident'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverAccept();
function serverAccept(){
current.incident_state = IncidentState.InProgress;
current.update();
current.resolved_by = gs.getUserID();
}
but the problem is when i click the button.. it will reload the form and automatically back to the list like a submit button.. when you click the submit button it will automatically go to the list ..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 02:26 AM
but the problem is when i click the button.. it will reload the form and automatically back to the list like a submit button.. when you click the submit button it will automatically go to the list ..
In your server part of the script after current.update() you can use:
action.setRedirectURL(current)
This will redirect the user back to the incient form instead of the list