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

Question

Question

Setting Revision Field to New Revision Value

asked on September 21, 2017

I have the following fields:

When Engineering Review is on, the Revised Revision field needs to be applied to the Revision field (and stick):

$(document).ready(function(){

//Set revised value for Revision field
  if ($('#Field167-0').is(':checked')) //If engReviewComplete radio box is on
  {
    $('.revision input').val($('.revisedRevision input').val()).change(); //Set Revision field to revisedRevision value
  }

});  //close document.ready

But it's not! When this task goes to the next person, it still shows as Rev. 00 when it should show as Rev. 01. What am I doing wrong?

0 0

Answer

SELECTED ANSWER
replied on September 21, 2017

Yea, read-only fields will not save any changes made with javascript. If the field is hidden you can remove the read-only setting, but if that is not an option you can update your code to:

  1. remove the read-only attribute
  2. update the value
  3. add the read-only attribute back
0 0

Replies

replied on September 21, 2017 Show version history

Hi Gloria,

Try this:

$(document).ready(function(){
  $('.engReviewComplete input').click(function(){
    $('.revision input').val($('.revisedRevision input').val());
  })
});

Your script is checking the condition of your if statement as soon as your document runs. The page loads, sees that the radio button is unchecked, and finishes. You need to add a trigger to set the new revision number. I have that trigger as when the radio button gets clicked.

0 0
replied on September 21, 2017

What I have is working. It does fill in the Revision field with the updated Revision level. The problem is that the value is not retained when it moves on to the next person.

0 0
replied on September 21, 2017

Are any of the fields involved read-only?

0 0
replied on September 21, 2017 Show version history

Wait ... the Revision field is read only! I know where you are going with this. I'll get back to you!

0 0
SELECTED ANSWER
replied on September 21, 2017

Yea, read-only fields will not save any changes made with javascript. If the field is hidden you can remove the read-only setting, but if that is not an option you can update your code to:

  1. remove the read-only attribute
  2. update the value
  3. add the read-only attribute back
0 0
replied on September 21, 2017

Darn read-only gets me every time! Thank you!!!!

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

Sign in to reply to this post.