You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Change Reject button value works, but not submitting

posted on April 24, 2018 Show version history

I am attempting to change the value of the Reject button when a checkbox is checked. That part works fine:

// if send employee attest email is checked, change cancel button to 'send attest email'
  	$('.sendAttestEmail input').on('click', function(){  
      if (this.checked){
      	$('.Reject').val('Attest').addClass('Attest');
      }
      else{
      	$('.Attest').val('Reject').removeClass('Attest');
      }
});

I also 'hijack' it by removing the type 'submit' and change it to 'button'. I add the 'submit' back in after the click has occurred and some actions are taken:

  $('.Reject').prop('type', 'button').removeClass('Submit').addClass('fakeReject');//to hijack

Upon click of .Reject, I am getting no action. Is this because the class changed after document ready?

  $('.Approve, .Reject').on('click', function(){  
//do stuff
});

Anyone have a suggestion? This is driving me crazy.

Thanks!

0 0
replied on April 24, 2018 Show version history

this is working:

 

//on click of Attest(send attest email) remove required on all fields
  $('.Reject').click(function(){
    var revType = $(this).val();
    if (revType=='Attest'){
	
      //remove all required fields (back end validation turned off)
      $('*[required]').each(function() { 
         $(this).removeClass('required')
      	 $(this).removeAttr('required');
    	 });
    }
   		$(this).prop("type", "submit");
          
  });

 

EDIT: this works for submitting but it is deleting data from a table with dates in it.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.