Jump to content

Update field depending on content of other fields


Recommended Posts

Hi there,

I have records called Cards, which span 5 different stages.  If the first part of the Card is completed, the user is in stage 1.  If the first and second part is completed, they are in stage 2 etc etc.  I'd like to automate this (currently they can choose their own stage via a dropdown), and have written the following script, but it's not working.

<script>
var count_Brief= ("[@field:Brief]").length;
var count_AnalystNotes = ("[@field:Analyst_Notes]").length;
var count_RecTest = ("[@field:Recommended_test]").length;
var count_Result= ("[@field:Actual_result]").length;

if (count_Brief > 1) {
document.getElementById("EditRecordStage").innerHTML = "2. Brief";
} 
else if (count_Brief > 1 && count_AnalystNotes > 1) {
document.getElementById("EditRecordStage").value = "3. Analysis";
}
else if (count_Brief > 1 && count_AnalystNotes > 1 && count_RecTest > 1) {
document.getElementById("EditRecordStage").value = "4. Test";
}
else if (count_Brief > 1 && count_AnalystNotes > 1 && count_RecTest > 1 && count_Result > 1) {
document.getElementById("EditRecordStage").value = "5. Result";
}
else {
document.getElementById("EditRecordStage").value = "1. Question";
}

</script>

Does anyone have any insight here?

Many thanks

Nikki

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...