Nothing happens when clicking the safe button

rss

Posted by Phoenix - May 20 ’15 at 02:37

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?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 19 days
    #1 by Dmitry Kozlov May 20 ’15 at 05:13

    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.

  • Phoenix
    Member
    Member for: 7 years
    #2 by Phoenix May 22 ’15 at 12:49

    [#1]: 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?

  • Phoenix
    Member
    Member for: 7 years
    #3 by Phoenix May 22 ’15 at 02:06

    I'm so sorry. My fault, I accidentaly use a button instead of a safe button. Sorry for bothering and thanks for helping

Displaying 1 to 3 of 3 messages