gr.insert doesn't work

yundlu316
Kilo Guru

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!