Devices - Edit: Revise and simplify javascript.

This commit is contained in:
Nate
2020-03-04 17:54:47 -07:00
parent 5f882529cc
commit 7cbccd767d

View File

@@ -1669,25 +1669,17 @@
echo "</form>";
echo "<script>\n";
// trigger initial onchage to set button state
echo " $(window).on('load', function(event){\n";
// triger initial onchage to set button state
echo " $('#device_profile_uuid').trigger('change')";
echo " $('#device_profile_uuid').trigger('change')";
echo " });\n";
//capture enter key to submit form
echo " $(window).keypress(function(event){\n";
echo " if (event.which == 13) { submit_form(); }\n";
echo " });\n";
// capture device selection events
echo " $('#device_profile_uuid').on('change',function(event){ \n";
echo " if (this.value == '') {\$('#device_profile_edit').hide()} else {\$('#device_profile_edit').show()} \n";
//capture device selection events
echo " $('#device_profile_uuid').on('change',function(event){ \n";
echo " if (this.value == '') {\$('#device_profile_edit').hide()} else {\$('#device_profile_edit').show()} \n";
echo " }); \n";
// convert password fields to
//hide password fields before submit
echo " function submit_form() {\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo " function submit_form_2() {\n";
echo " $('input:password').css('visibility','hidden');\n";
echo " $('input:password').attr({type:'text'});\n";
echo " hide_password_fields();\n";
echo " $('form#frm').submit();\n";
echo " }\n";
echo "</script>\n";