Skip navigation
Currently Being Moderated

Alert message in javascript if drop down in 1 column is blank and other column is not blank

Jun 15, 2011 7:38 AM

 

What I’m trying to do is have a java window alert pop up if the PNR column is blank and the BOM column is not blank on each row. I also put a cold fusion If statement around this javascript that the CN_Entry column in the Items table has to be an “N”. This code all actually works, but it only works on the row with the latest or newest item with an “N” in the CN_Entry column. I would like this to work on every row, so that if someone does this on any row, or multiple rows, this alert box will keep popping up until all the conditions are satisfied. What do I need to change to make this javascript work? Thanks.

 

 

 

 

 

<cfif CN_Entry EQ "N">

 


 

<SCRIPT LANGUAGE="JavaScript">

 

 

 

<!-- Begin

 

function verify() {

 

var themessage = "Please enter ";

 

 

 

if (EditItem.PNR_Approval_Initials#ItemID#.selectedIndex == 0 && EditItem.BOM_Approval_Initials#ItemID#.selectedIndex > 0)

 

{

 

alert("You must enter some PNR initials for ECO #ECID_SPEC# Part Number: #Part_Number#");

EditItem.PNR_Approval_Initials#ItemID#.focus();

return (false);

}

 

else

{

document.EditItem.submit();

}

 

}

//  End -->

</script>

</cfif>

 

Andy

 
Replies
  • Currently Being Moderated
    Jun 15, 2011 9:11 AM   in reply to jamie61880

    The first thing you have to do is to remove the ColdFusion conditional logic.  ColdFusion runs on the server.  JS runs on the client.

     

    The next thing is to call the function from an event that happens on the web page.  form onsubmit seems like a good choice.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points