gr.insert doesn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 02:55 PM
I'm using a UI Page to build a custom form and am using the following insert script to take what the user submits and puts each field in its corresponding field in the table:
<script>
function Redirect() {
window.location="www.somepage.com";}
</script>
<script>
function submitRequest()
{
var gr = new GlideRecord('u_employee_form');
gr.initialize();
gr.u_item_a = document.getElementById('A').value;
gr.u_item_b = document.getElementById('B').value;
gr.u_item_c = document.getElementById('C').value;
gr.insert();
}
</script>
HTML button: <button id="myButton" onclick = "submitRequest(); Redirect();">Submit</button>
This script seem to work great with just 3 fields to insert, but when I tried to enter 45 different fields, the page stopped working. The submit button no longer redirects, it's as if it loses all functionality or can't handle the code. Am I doing something wrong here?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2016 07:55 PM
Hi Berny,
I've checked my syntax countless times and I don't believe it to be the issue. I've added all 40 variables back into the code and tried filling out each variable and pressing submit, one at a time. Once I filled out a certain number of variables, the submit button works. I'm super confused right now...
Also I'm not familiar with GlideAjax, is the syntax for that the same as GlideRecord?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2016 09:52 PM
Hi David,
Here goes some links so that you can accomplish what you need using a GlideAjax or at a minimum an asynchronous GlideRecord.
Examples of asynchronous GlideAjax
In case you still want to go through the GlideRecord route, i will then at least propose you do it with an asynchronous call
Can you call a script include from a client script - without GlideAjax?
Thanks,
Berny