Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


App Alert Pops Up Repeatedly

Engaged ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

I'm working on a form where one of the selections of a rb group is not yet available. For this, I wanted to use an app alert to inform the user of this if selected.

I also want the rb button to reset the entire group and hide some button/text fields. I've come up with SEVERAL iterations of the below script as well as tried to call the actions by defining a variable to the alert and calling the nType value. This also makes the alert repeat infinitely. The position of resetForm() and the alert also will cause it to loop infinitely. I'm calling out very similar code using regex and it's doing what I want. It's only seeming to struggle with the alert...

//set cards
	var j = 0;
	for(var i = 1; i <= 8; i++) {
		var side = ["left", "right"];
			if(i % 2 == 1 && i != null) {
				j += 2;
				this.getField("card" + i).setAction("MouseUp",
					'for(var x = 0; x < this.numFields; x++) {\n' +
						'var fname = this.getNthFieldName(x);\n' +
						'var f = this.getField(fname);\n' +
						'var aText = /(out|load|amp|oc|note)-r\\d+-\\d-(left|right)/;\n' +
						'var bText = /rsi-(r\\d+|j2-pos\\d+)-\\d-(left|right)/;\n' +
						'var cText = /can-r\\d-(left|right)/;\n' +
						'var dText = /(amp|oc)-r\\d+-\\d-(left|right)/;\n'  +
						'var aPos = /pos-r\\d+-\\d-(left|right)/;\n' +
						'var aNeg = /neg-r\\d+-\\d-(left|right)/;\n' +
						'var bNeg = /j2-neg\\d+-\\d-(left|right)/;\n' +
						'var cards = /(aux|can|hc-bridge|hs-driver|lc-bridge|filler|rsi-probe|rsi-touch|rsi-trutank|rsi-t10|solid)-\\d-(left|right)/;\n' +
						'if(event.target.value == "Aux") {\n' +
							'if(f.type == "button" && !f.name.match("aux-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'this.getField(\"aux-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(dText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || dText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n'+
						'else if(event.target.value == "CAN 3") {\n' +
							'if(f.type == "button" && !f.name.match("can-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"can-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(cText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || bText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "HC Half Bridge") {\n' +
							'if(f.type == "button" && !f.name.match("hc-bridge-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"hc-bridge-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "HS Driver") {\n' +
							'if(f.type == "button" && !f.name.match("hs-driver-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"hs-driver-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "LC Half Bridge") {\n' +
							'if(f.type == "button" && !f.name.match("lc-bridge-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"lc-bridge-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if((f.name.match(aText) || f.name.match(aPos)) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Filler") {\n' +
							'if(f.type == "button" && !f.name.match("filler-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"filler-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI Probe Tanks") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-probe-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-probe-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI Touch Tanks") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-touch-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-touch-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI TruTank") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-trutank-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-trutank-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI 10 Therm") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-t10-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-t10-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Solid State") {\n' +
							'if(f.type == "button" && !f.name.match("solid-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"solid-' + j + "-" + side[0] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Net Connections") {\n' +
							'if(f.type == "button" && f.name.match(cards) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[0] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'resetForm([\"card' + i + '\"]);\n' +
							'app.alert({cMsg: "The Network Connections card is still in development and not available at this time.", nIcon:3, cTitle: "Firefly M1 Panel"});\n' +
						'}\n' +
					'}'
				);
			}
			else if(i % 2 == 0 && i != null) {
				this.getField("card" + i).setAction("MouseUp",
					'for(var x = 0; x < this.numFields; x++) {\n' +
						'var fname = this.getNthFieldName(x);\n' +
						'var f = this.getField(fname);\n' +
						'var aText = /(out|load|amp|oc|note|pos)-r\\d+-\\d-(left|right)/;\n' +
						'var bText = /rsi-(r\\d+|j2-pos\\d+)-\\d-(left|right)/;\n' +
						'var cText = /can-r\\d-(left|right)/;\n' +
						'var dText = /(amp|oc)-r\\d+-\\d-(left|right)/;\n'  +
						'var aPos = /pos-r\\d+-\\d-(left|right)/;\n' +
						'var aNeg = /neg-r\\d+-\\d-(left|right)/;\n' +
						'var bNeg = /j2-neg\\d+-\\d-(left|right)/;\n' +
						'var cards = /(aux|can|hc-bridge|hs-driver|lc-bridge|filler|rsi-probe|rsi-touch|rsi-trutank|rsi-t10|solid)-\\d-(left|right)/;\n' +
						'if(event.target.value == "Aux") {\n' +
							'if(f.type == "button" && !f.name.match("aux-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'this.getField(\"aux-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || dText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n'+
						'else if(event.target.value == "CAN 3") {\n' +
							'if(f.type == "button" && !f.name.match("can-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"can-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(cText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || bText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "HC Half Bridge") {\n' +
							'if(f.type == "button" && !f.name.match("hc-bridge-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"hc-bridge-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "HS Driver") {\n' +
							'if(f.type == "button" && !f.name.match("hs-driver-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"hs-driver-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "LC Half Bridge") {\n' +
							'if(f.type == "button" && !f.name.match("lc-bridge-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"lc-bridge-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if((f.name.match(aText) || f.name.match(aPos)) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Filler") {\n' +
							'if(f.type == "button" && !f.name.match("filler-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"filler-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI Probe Tanks") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-probe-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-probe-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI Touch Tanks") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-touch-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-touch-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI TruTank") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-trutank-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-trutank-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "RSI 10 Therm") {\n' +
							'if(f.type == "button" && !f.name.match("rsi-t10-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"rsi-t10-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(bText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Solid State") {\n' +
							'if(f.type == "button" && !f.name.match("solid-") && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n'+
							'this.getField(\"solid-' + j + "-" + side[1] + '\").display = display.visible;\n' +
							'if(f.name.match(aText) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.visible;\n' +
							'}\n' +
							'if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
						'}\n' +
						'else if(event.target.value == "Net Connections") {\n' +
							'if(f.type == "button" && f.name.match(cards) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] + '\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match(\"' + j + '\") && f.name.match(\"' + side[1] +'\")) {\n' +
								'f.display = display.hidden;\n' +
							'}\n' +
							'resetForm([\"card' + i + '\"]);\n' +
							'app.alert({cMsg: "The Network Connections card is still in development and not available at this time.", nIcon:3, cTitle: "Firefly M1 Panel"});\n' +
						'}\n' +
					'}'
				);
			}
		}
TOPICS
Create PDFs, JavaScript, PDF forms

Views

67

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 29, 2021 Jun 29, 2021
You put the alert in a loop, so it would show in each iteration of that loop.

Likes

Translate

Translate
Adobe Community Professional ,
Jun 28, 2021 Jun 28, 2021

Copy link to clipboard

Copied

Instead of providing the code that sets the code, why not provide the code itself, or better yet, the actual file?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

Here are the variables:

for(var x = 0; x < this.numFields; x++) {
	var fname = this.getNthFieldName(x);
	var f = this.getField(fname);
	var aText = /(out|load|amp|oc|note)-r\d+-\d-(left|right)/;
	var bText = /rsi-(r\d+|j2-pos\d+)-\d-(left|right)/;
	var cText = /can-r\d-(left|right)/;
	var dText = /(amp|oc)-r\d+-\d-(left|right)/;
	var aPos = /pos-r\d+-\d-(left|right)/;
	var aNeg = /neg-r\d+-\d-(left|right)/;
	var bNeg = /j2-neg\d+-\d-(left|right)/;
	var cards = /(aux|can|hc-bridge|hs-driver|lc-bridge|filler|rsi-probe|rsi-touch|rsi-trutank|rsi-t10|solid)-\d-(left|right)/;
/*loop continues*/

Here's the section:

	else if(event.target.value == "Net Connections") {
		resetForm(["card1"]);
		if(f.type == "button" && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		app.alert({cMsg: "The Network Connections card is still in development and not available at this time.", nIcon:3, cTitle: "Firefly M1 Panel"});
	}

Here's the code:

for(var x = 0; x < this.numFields; x++) {
	var fname = this.getNthFieldName(x);
	var f = this.getField(fname);
	var aText = /(out|load|amp|oc|note)-r\d+-\d-(left|right)/;
	var bText = /rsi-(r\d+|j2-pos\d+)-\d-(left|right)/;
	var cText = /can-r\d-(left|right)/;
	var dText = /(amp|oc)-r\d+-\d-(left|right)/;
	var aPos = /pos-r\d+-\d-(left|right)/;
	var aNeg = /neg-r\d+-\d-(left|right)/;
	var bNeg = /j2-neg\d+-\d-(left|right)/;
	var cards = /(aux|can|hc-bridge|hs-driver|lc-bridge|filler|rsi-probe|rsi-touch|rsi-trutank|rsi-t10|solid)-\d-(left|right)/;
	if(event.target.value == "Aux") {
		if(f.type == "button" && !f.name.match("aux-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("aux-2-left").display = display.visible;
		if(f.name.match(dText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(bText || cText || dText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "CAN 3") {
		if(f.type == "button" && !f.name.match("can-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("can-2-left").display = display.visible;
		if(f.name.match(cText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(aText || bText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "HC Half Bridge") {
		if(f.type == "button" && !f.name.match("hc-bridge-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("hc-bridge-2-left").display = display.visible;
		if(f.name.match(aText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "HS Driver") {
		if(f.type == "button" && !f.name.match("hs-driver-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("hs-driver-2-left").display = display.visible;
		if(f.name.match(aText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "LC Half Bridge") {
		if(f.type == "button" && !f.name.match("lc-bridge-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("lc-bridge-2-left").display = display.visible;
		if((f.name.match(aText) || f.name.match(aPos)) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(bText || cText || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		}
		else if(event.target.value == "Filler") {
		if(f.type == "button" && !f.name.match("filler-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("filler-2-left").display = display.visible;
		if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "RSI Probe Tanks") {
		if(f.type == "button" && !f.name.match("rsi-probe-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("rsi-probe-2-left").display = display.visible;
		if(f.name.match(bText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "RSI Touch Tanks") {
		if(f.type == "button" && !f.name.match("rsi-touch-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("rsi-touch-2-left").display = display.visible;
		if(f.name.match(bText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "RSI TruTank") {
		if(f.type == "button" && !f.name.match("rsi-trutank-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("rsi-trutank-2-left").display = display.visible;
		if(f.name.match(bText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "RSI 10 Therm") {
		if(f.type == "button" && !f.name.match("rsi-t10-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("rsi-t10-2-left").display = display.visible;
		if(f.name.match(bText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(aText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "Solid State") {
		if(f.type == "button" && !f.name.match("solid-") && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		this.getField("solid-2-left").display = display.visible;
		if(f.name.match(aText) && f.name.match("2") && f.name.match("left")) {
			f.display = display.visible;
		}
		if(f.name.match(bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
	}
	else if(event.target.value == "Net Connections") {
		resetForm(["card1"]);
		if(f.type == "button" && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		if(f.name.match(aText || bText || cText || aPos || aNeg || bNeg) && f.name.match("2") && f.name.match("left")) {
			f.display = display.hidden;
		}
		app.alert({cMsg: "The Network Connections card is still in development and not available at this time.", nIcon:3, cTitle: "Firefly M1 Panel"});
	}
}

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

You put the alert in a loop, so it would show in each iteration of that loop.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 29, 2021 Jun 29, 2021

Copy link to clipboard

Copied

LATEST

My apologies as I didn't explain the issue properly. Your answer is correct, however. I had considered that when coding, but I clicked on it dozens of times yesterday. I guess assumed it would only be 12 in naiveness whereas there are hundreds of fields the loop is looking at. for loop is for the regex variables that all of the rb widgets are using to hide buttons and text fields. Interestingly, the alert was not repeating with the script I provided.

 

The loop also was not hiding the buttons/text fields like all other widgets. The alert would repeat when I changed the locations of the actions. If I removed the alert, the buttons/text wouldn't hide. If I moved or removed the reset, the alert would repeat. If I remove the reset and alert, the regex query does its job correctly.

 

I'm considering targeting the specific widget of the rb group on a mouse down event. Only one out of 12 widgets require the alert. I also don't need the reset at all as there's no visible indicator that the field is checked. It's graphically grayed out in all states.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines