0 Replies Latest reply on Aug 6, 2015 10:24 AM by tlubins

    validate a selection and have an app.alert pop up if they cant pick it

    tlubins Level 1

      Hey everyone,

       

      I have a question regarding a validate function. I have a custom dialog box that you make selection in but, if you make a selection in the size and if that selection is 1/2 or 3/4 inch then you cant pick a ULJ model. Those are the only two sizes that limit what model can be chosen. I was wondering if it is possible to have an app.alert pop up if a user were to make a selection of a 1/2 and then tries to pick a ULJ model. I want that user to know that it is not allowed to do that. Is there any way to do that? Here is my validate code, the part in bold is what I last tried to do for this app.alert. The rest of the code runs smoothly. Thank you to anyone who helps!

       

      validate: function(dialog)

          {

             var oRslt = dialog.store();

             var bRtn = true;

             var selectMaterial = true;

             var selectModel = true;

             var selectSize = true;

             var selectFlangeClass = true;

                       for (var d in oRslt["matl"])

                           {

                            if (oRslt["matl"][d] > 0)

                            {

                             selectMaterial = false;//this means that you picked it and will pass

                            }

                           }

                       for (var e in oRslt["modl"])

                           {

                            if (oRslt["modl"][e] > 0)

                            {

                             selectModel = false;

                            }

                           }

                       for (var f in oRslt["size"])

                           {

                            if (oRslt["size"][f] > 0)

                            {

                             selectSize = false;

                            }

                           }

                       for (var y in oRslt["clas"])

                           {

                            if (oRslt["clas"][y] > 0)

                            {

                             selectFlangeClass = false;

                            }

                           }

                       if (selectMaterial == true || selectModel == true || selectSize == true || selectFlangeClass == true)

                           {

                            bRtn = (4 == app.alert("You have not made a selection in one of the following:\n\nMaterial\nModel\nSize\nFlange Class\n\nPlease make sure you have made a selection in all of the areas.",0,0));

                           }

                       return bRtn;

       

          if( listsize == '0.50"' || listsize == '0.75"');

                         {var e in oRslt["modl"] !== "ULJ"}

                          app.alert("Model ULJ can not be used in the 1/2 and the 3/4 bodies.\nPlease make another selection")

                        

          },