Hide OK button after click - UI Page

Vikram3
Giga Guru

Hello all,

I need to hide/disable OK button after click in a UI page. Below is the code snippet,

<tr>
    <td colspan="2" align="right">
      <g:dialog_buttons_ok_cancel 
         ok="return submitChanges()" 
         cancel="return submitCancel()" />
    </td>
  </tr>	
function submitChanges() {
	var taskId = gel('task_id').value;
	var selection = gel('yesno').value;
	if (selection.length < 1)	{
		document.getElementById('yesno_error').style.backgroundColor="#FFEBE8";
		document.getElementById('yesno_error').style.display="block";
		return false;
	}
	else		document.getElementById('yesno_error').style.display="none";
		
	var v_rsn_incomplete = '*err*';
	try {
		v_rsn_incomplete = gel('rsn_incomplete').value;
	} catch (e) {}
	if (v_rsn_incomplete.length < 1 && rsnSelect())	{
		document.getElementById('rsn_incomplete_error').style.backgroundColor="#FFEBE8";
		document.getElementById('rsn_incomplete_error').style.display="block";
		return false;
	}
	else		document.getElementById('rsn_incomplete_error').style.display="none";
		
	var notes = gel('work_notes_update').value;
	//.replace(/^\s+|\s+$/g,''); // trim
	if (notes.length < 1 && rsnSelect()) {
		document.getElementById('work_notes_error').style.backgroundColor="#FFEBE8";
		document.getElementById('work_notes_error').style.display="block";
		return false;
	}
	else
		document.getElementById('work_notes_error').style.display="none";
	
	g_form.clearValue("work_notes");
	
	return true;
	
}

Can anybody assist me on this. This is to restrict user to click multiple times on OK button.

1 ACCEPTED SOLUTION

Vikram3
Giga Guru

I achieved it by the below code snippet added in client script,

var ok = document.getElementById("ok_button");
ok.style.display = "none";

View solution in original post

3 REPLIES 3

Omkar Mone
Mega Sage

I got that. But I need to hide it after click.

Vikram3
Giga Guru

I achieved it by the below code snippet added in client script,

var ok = document.getElementById("ok_button");
ok.style.display = "none";