Jump to content
  • 0

Javascript If- Else If Not Working With External Parameters



I have the following JS code in my single record update datapage. I want to update only certain blocks of data if the correct course code is chosen. It appears that ALL of the fields are updated everytime I run this datapage. All values are coming from external parameters. The good news is that the parameters are being read and written to the table..... bad news is that I only want the subset of fields to be written to the table... please help. All fields are "HIDDEN" and external parameters are checked to receive on load (not pass on exit)...


My Code:


<script language="JavaScript">
function myFunctionV1()
var coursecheck = document.getElementById("EditRecordcoursecode").value;
if (coursecheck = 'CTvi') {
    document.getElementById("EditRecordCVHAR").value = CVHAR;
    document.getElementById("EditRecordbox1i").value = box1i;
    document.getElementById("EditRecordbox2i").value = box2i;
    document.getElementById("EditRecordbox3i").value = box3i;
    document.getElementById("EditRecordbox4i").value = box4i;
    document.getElementById("EditRecordbox5i").value = box5i;
    document.getElementById("EditRecordbox6i").value = box6i;
    document.getElementById("EditRecordbox7i").value = box7i;
    document.getElementById("EditRecordbox8i").value = box8i;
    document.getElementById("EditRecordbox9i").value = box9i;
    document.getElementById("EditRecordbox10i").value = box10i;
    document.getElementById("EditRecordbox1a").value = box1a;
    document.getElementById("EditRecordbox2a").value = box2a;
    document.getElementById("EditRecordbox3a").value = box3a;
    document.getElementById("EditRecordbox4a").value = box4a;
    document.getElementById("EditRecordbox5a").value = box5a;
    document.getElementById("EditRecordbox6a").value = box6a;
    document.getElementById("EditRecordbox7a").value = box7a;
    document.getElementById("EditRecordbox8a").value = box8a;
    document.getElementById("EditRecordbox9a").value = box9a;
    document.getElementById("EditRecordbox10a").value = box10a;
} else if (coursecheck = 'CTpp')  {
    document.getElementById("EditRecordCPACH").value = CPACH;
    document.getElementById("EditRecordCPSOC").value = CPSOC;
    document.getElementById("EditRecordCPOBS").value = CPOBS;
    document.getElementById("EditRecordCPTHI").value = CPTHI;
} else {
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Hello DCT247,


Please try unchecking of external parameters to receive on load. When these checkboxes are checked, fields get the parameters.

If you want to set parameters by condition, maybe it is better to uncheck all checkboxes and then run the Script.


Does it work for you?

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.

Answer this question...

×   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.

  • Create New...