Page 1 of 1

Nothing happens when clicking the safe button

Posted: 20 May 2015
by Phoenix
Hi there

I'v got a strange but important problem. I have several safe buttons. The standard safe and close buttons are working just fine. But the others do not safe the form. I have following code in the OnClick handler

var error = false;

fd.field('status').value('3b');


var text = fd.field('Justification').control()._el().find('div.ms-rtestate-write').text().replace(/\W/g, '');

if (text == '') {

msgError = "Please justify your decision!";

error = true;

} else {

error = false;

}


if (error == true) {

alert(msgError);

return false;

} else {

return true;

}


Although the alerts are appearing, nothing happens after that. I habe similiar buttons in other forms and there they are just working fine. I also tried to delete the buttons and create them again. Still no success.


Any ideas?

Re: Nothing happens when clicking the safe button

Posted: 20 May 2015
by Dmitry Kozlov
Hi,

I see just a single alert in your code and after that it returns false, so the form will not be submitted after the alert.

Re: Nothing happens when clicking the safe button

Posted: 22 May 2015
by Phoenix
Yeah, well it returns only an alert if there is an error, if not it should return true and then submit. Or am I wrong?

Re: Nothing happens when clicking the safe button

Posted: 22 May 2015
by Phoenix
I'm so sorry. My fault, I accidentaly use a button instead of a safe button. Sorry for bothering and thanks for helping