Texting About Drugs: Is It Illegal in Arizona? ARS 13-3417
Detectives building a drug case out of your texts? Under A.R.S. § 13-3417, using wire or electronic communication to facilitate a felony drug offense is a separate class 4 felony charged on top of the drug case. Call us before any interview.
As Seen On
Recognized By
Featured Answer
What Does A.R.S. § 13-3417 Actually Say?
Yes, it can be. Texting about drugs is not automatically a crime, but under A.R.S. § 13-3417 using any wire or electronic communication to facilitate a felony drug offense is a separate class 4 felony charged on top of the drug count itself.
If detectives have downloaded your phone in an Arizona drug investigation, the messages are not just evidence of the drug charge. They can be a charge of their own. That is the part almost nobody sees coming, and it is why a case that looks like one count on paper can arrive at arraignment carrying two or more.
This article walks through what A.R.S. § 13-3417 actually reaches, how it stacks on top of the underlying offense, and — section by section — where defense attorneys apply pressure. If you are trying to understand the underlying charge itself, start with our Arizona drug crimes defense hub.
It makes the communication itself unlawful. Subsection A reads, in full: “It is unlawful for a person to use any wire communication or electronic communication as defined in section 13-3001 to facilitate the violation of any felony provision or to conspire to commit any felony provision of this chapter or chapter 23 of this title.”
Read that carefully, because three things in it drive everything else. First, the prohibited act is using a communication — not possessing, transporting, or selling anything. Second, the communication has to be tied to a felony provision; the section does not reach every drug offense on the books. Third, the statute expressly reaches conspiring to commit a felony provision, not just facilitating a completed one. A deal that never happened is not automatically outside the statute.
What Counts as a “Wire Communication” or an “Electronic Communication”?
The definitions come from a different statute. Section 13-3417 does not define these terms itself — it borrows them from A.R.S. § 13-3001, which supplies both:
- Wire communication: “Any aural transfer made in whole or in part through facilities for transmission of communications by wire, cable or other like connection between point of origin and reception.”
- Electronic communication: “Any transfer of signs, signals, writing, images, sounds, data or intelligence transmitted in whole or in part by wire, radio, electromagnetic, photoelectronic or photooptical system.”
The electronic communication definition carries express exclusions: it does not include wire or oral communication, tone-only paging devices, or tracking devices.
Here is the part worth being precise about, because a lot of what gets written on this topic is not. The statute does not name text messages, email, or social media messaging by name. Whether a particular medium is covered depends on whether it fits inside those general categories — a question of statutory interpretation applied to the specific facts of how the message traveled, not a label anyone gets to assume. In practice, prosecutors treat ordinary phone and messaging traffic as squarely inside the definitions, and in most Arizona courts that argument is not where a case is won. But it is a question, not a given, and it deserves to be examined rather than conceded on day one.
What Does It Mean to “Facilitate” a Felony Drug Offense?
Less than most people assume. The statute does not require that the communication complete a sale, name a drug, state a quantity, or even be answered. It requires that the communication be used to facilitate the violation of a felony provision — or to conspire to commit one.
That framing is what makes the section so broad in practice. Defense attorneys commonly see the state build a 13-3417 count out of material like this:
- Messages arranging a meeting time or location connected to an alleged transaction;
- Calls coordinating a pickup, a drop, or a ride;
- Threads negotiating price, amount, or availability;
- Communications passing along a warning, a name, or a contact;
- Messages the state reads as coded, even when the words themselves are ordinary.
The last two categories are where the real fight lives. A message that says “you around?” means nothing standing alone. It only becomes evidence of facilitation once the state supplies an interpretation and a surrounding felony to attach it to — and both of those are contestable.
Can Texting About Drugs Add a Second Charge?
As a separate count, with its own classification. This is the practical point most readers need. If you are charged with a felony drug offense and the state believes your phone was used to facilitate it, you are looking at the underlying count plus a 13-3417 count — two convictions, two classifications, and a sentencing picture that is not the one you were bracing for.
Subsection C sets the classification, and it works as a rule with one exception: “A person who violates this section is guilty of a class 4 felony except if the felony facilitated carries a class 5 or 6 designation in which case a violation of this section shall carry the same classification as the felony facilitated.”
How the Classification Works Under Subsection C
Statute: A.R.S. § 13-3417 — definitions borrowed from A.R.S. § 13-3001
Because classification tracks the facilitated felony in the class 5 and 6 situations, identifying exactly which felony provision the state says was facilitated is not a technicality. It sets the ceiling on the communication count. That is one reason charges built around alleged sales — such as narcotic drug sales under A.R.S. 13-3408 or possession of dangerous drugs for sale under A.R.S. 13-3407 — need to be pinned down early in the case.
What Does the State Actually Have to Prove?
More than the existence of a message. To sustain a 13-3417 count, the state has to establish that a communication fitting the 13-3001 definitions was used, that the defendant used it, and that it facilitated the violation of a felony provision or was used to conspire to commit one. Each of those is a separate proof problem, and each is a place a case can come apart.
Whose device and whose account?
A phone found in a car, a shared family tablet, a prepaid device with no subscriber name, a messaging account someone else has the password to — none of these establish who was holding the phone when a message was sent. In Arizona courts, attribution is proved with circumstantial evidence: subscriber records, other content on the device, patterns of use, and sometimes an admission in an interview. That last one is why interviews matter so much.
Did the message actually facilitate a felony?
Plenty of communication between people who know each other is ambiguous, social, or about something else entirely. The state’s theory usually depends on reading a thread in the light of everything else it has found. Strip away the assumption and ask what the words alone establish — frequently, less than the charging document implies.
Is the underlying felony provable at all?
This is the structural weakness in the charge. A 13-3417 count depends on a felony provision having been facilitated or conspired toward. If the underlying felony cannot be proved — because the substance evidence is suppressed, the weight is wrong, the offense is not actually a felony, or the case simply is not there — the communication count has a serious problem of its own. Cases involving alleged distribution networks, like those our Phoenix drug trafficking defense team handles, often turn on exactly this dependency.
How were the messages obtained?
Phone extractions are typically conducted under a search warrant, and warrants have scope. What device was authorized, what categories of data, what time period, what offense — a full extraction that ranges far beyond what a judge approved is a suppression issue worth litigating, and it is not unusual. Our guide to what happens when police search your phone in Arizona covers the mechanics.
Where Does the Defense Push Back?
At the seams between the message and the meaning. Practically, that means five lines of attack, usually run together rather than in sequence:
- Attribution. Tie the account and the handset to a specific person at a specific moment, or the count fails. Shared devices, family plans, borrowed phones, and multi-user accounts all break that chain.
- Interpretation. Contest the state’s translation of ambiguous or slang language, including whether an investigator’s reading is expert opinion or simply a guess in a uniform.
- Warrant scope and extraction method. Compare what the warrant authorized against what the extraction actually captured, and examine how the report was generated, filtered, and produced.
- The dependency. Attack the underlying felony first. The communication count is built on it.
- Completeness. Demand the full thread, not the excerpt. Messages read very differently with the surrounding conversation restored, and partial production is common.
What Should You Do in the First 72 Hours?
Do this
- Preserve everything. Leave phones, tablets, and accounts exactly as they are — no deleting, no resetting, no cleanup.
- Call a defense lawyer before any interview. Before, not after. Detectives conducting these interviews already have the extraction.
- Write down, for your attorney only, who had access to each device and account and when.
- Locate carrier records, account ownership documents, and anything showing shared use of a device.
Do not do this
- Do not consent to a phone search. Consent gives away years of unrelated data and waives the scope arguments a warrant would otherwise leave you. Declining is not evidence of guilt.
- Do not talk to detectives without counsel present, no matter how much you want to explain what a message meant. Explanations are frequently what supplies the element the state was missing.
- Do not discuss the case over text, on social media, or with anyone who may become a witness — including a co-defendant.
- Do not assume the drug charge is the whole exposure. Ask specifically whether a 13-3417 count has been filed or is under consideration.
The Experts We Bring to the Table
A communications case is a technical case. These are the specialists we work with to test what an extraction report claims — and what it quietly assumes.
Mobile Device Forensic Examiner
Testing The Extraction
Independently reviews the phone image and the extraction report, checking what tools and versions produced it, what was filtered out, and whether deleted or fragmentary messages were reconstructed accurately.
Cell-Site & Location Analyst
Checking The Location Claims
Examines call detail records and tower data to test whether the state’s map of where a phone was actually supports its theory, and where the margin of error swallows the conclusion.
Data-Extraction & Warrant-Scope Reviewer
Auditing What Was Searched
Lines the warrant up against the extraction to identify data pulled outside the authorized device, category, time period, or offense — the raw material for a suppression motion.
Account Attribution Specialist
Separating Device From Defendant
Maps subscriber records, logins, handset changes, and multi-user access to test whether the state can tie a specific message to one specific person rather than one shared device.
Language & Slang Interpretation Expert
Reading Ambiguous Messages
Evaluates whether an investigator’s translation of coded or colloquial language is supported by anything beyond assumption, and what an ambiguous thread reasonably means in full context.
Narcotics Investigative-Practices Expert
Testing The Investigation
Assesses whether the investigation followed accepted practice in how communications were collected, documented, and interpreted, and where shortcuts shaped the conclusions in the report.
How Tamou Law Group Defends A.R.S. § 13-3417 Cases
We start before charges are filed whenever the timing allows. In the pre-charge window — after a phone is seized but before a prosecutor decides what to file — there is genuine room to work: showing that attribution is weaker than the report suggests, raising warrant-scope problems while they are still cheap to fix, and making sure a communication count is not added reflexively to a case that cannot support the underlying felony. A charging decision made on an unexamined extraction is much harder to unwind after the indictment.
Once a case is filed, we push on disclosure. That means the complete extraction and not the state’s excerpt: the full forensic image, the examiner’s notes, tool names and versions, filter settings, the search warrant and its supporting affidavit, chain-of-custody documentation, and carrier records including subscriber and handset history. Selective production of a few screenshots is common, and it is exactly how an ambiguous thread ends up looking like an admission.
We also give clients an unvarnished plea-collateral analysis before any decision. A 13-3417 conviction is a separate felony conviction with its own consequences — on immigration status, professional and occupational licensing, firearm rights, employment, and how any future case is charged — and those consequences do not disappear because the count was the smaller number on the plea sheet. Our team includes former prosecutors, law enforcement officers, and public defenders, working from our offices at 9375 E Shea Blvd in Scottsdale and 3110 N Central Ave in Phoenix. Call 623-321-4699 for a confidential consultation.
Related Arizona Drug Charge Guides
Award-Winning Criminal Defense Law Firm
When you are looking for the best Phoenix criminal defense lawyers, these are the independently verified credentials that matter, earned by Founding Attorney Michael Tamou and a full team of attorneys, including former prosecutors, public defenders, and law enforcement.
Client reviews
What our clients say
I highly recommend Michael Tamou! He recently handled my GCE application, and I couldn't be more grateful for his help. From the very beginning, Michael was incredibly professional, knowledgeable, and thorough in making sure everything was completed perfectly. What stood out the most was his compassion—legal processes can be highly stressful, but he treated me with genuine care, kept me informed, and made me feel completely supported throughout. If you need a dedicated and skilled attorney who truly cares about his clients, look no further than Michael Tamou.
DMDan MillerGoogle review · Oct 2026Michael Tamou is an exceptional attorney! Facing a case that could affect my future was incredibly stressful, but from our first conversation, he provided honest guidance, reassurance, and a clear plan. He immediately got to work, personally reviewing the evidence and reports, filing the necessary motions, and keeping me informed throughout the process. His expertise, persistence, and genuine care gave me confidence that my case was in capable hands. I’m incredibly grateful that Michael achieved the outcome I had hoped and prayed for: my case was dismissed. I highly recommend him to anyone seeking a skilled, dedicated, and caring attorney.
TJTammy JohnsonGoogle review · Sep 2026I had a great experience working with Michael. From the beginning, they were professional, knowledgeable, and responsive. They took the time to explain everything clearly, kept me informed throughout the process, and always had my best interests in mind. Their dedication and attention to detail gave me confidence during a stressful time, and they achieved a positive outcome for my case. I truly appreciate their hard work and would highly recommend them to anyone looking for an experienced and trustworthy attorney. Thank so much Tamou Law Group.
AAAlejandra ArevaloGoogle review · Aug 2026This is a great group of attorneys that work together!! There’s no other law firm I’d use for any situation. They put the time and effort into helping out any way they can. Mike and Kristie were both amazing in handling my situation and being transparent during the whole process.
TTJ2KGoogle review · Nov 2026I can’t thank Tamou Law Group enough for helping me with my case. They truly went above and beyond, and I’m incredibly grateful for their hard work, dedication, and support. Having a team in your corner that cares makes all the difference during a stressful time. Five stars don’t feel like enough! I highly recommend them to anyone looking for a law firm that will go the extra mile. Thank you for everything!
EGEvan GibraelGoogle review · Oct 2026I cannot recommend Ms. Jacie Cotterell highly enough. From start to finish, she was absolutely amazing throughout the entire process. She was professional, knowledgeable, and always took the time to answer my questions and explain everything clearly, which gave me a lot of peace of mind during a stressful situation. What stood out most was how genuinely caring and dedicated she was. I always felt like she had my best interests at heart, and her communication was excellent every step of the way. She made a difficult experience much easier to navigate and was always patient, supportive, and reassuring. I am incredibly grateful for all of her hard work and guidance. If you’re looking for someone who is compassionate, trustworthy, and truly committed to helping her clients, I wholeheartedly recommend Ms. Jacie Cotterell. Thank you again for everything, wyou made a lasting positive impact, and I truly appreciate all that you did.
BPBlaze PeralesGoogle review · Aug 2026Michael is hands down the best in the business. The day I called him he explained everything about my daughter’s situation and took the time to research the charges. He then gave me a price and gave me a chance to think it through before hiring him and two weeks later we retained his services. Michael went to work at that point with his team and brought results that no one else could do. My daughter now has a second chance to get her life on track over a few costly mistakes that could have landed her in prison and with a felony record but Michael did not allow that to happen. If you need solid representation that fights for you then hire Michael.
RHrob hardeeGoogle review · Aug 2026Kristie & Mike didn’t just see me as another client but as a person in need of help. The level of professionalism & communication going through my whole case made me feel at peace. Amazing lawyers & 10/10 would recommend!
DNDanny NguyenGoogle review · Oct 2026We {Carrie & Ted S.} are very pleased that we chose Mike Tamou Law Group to represent a criminal case that was against our granddaughter. The case against her was for two different ordeals, and in both situations - the cases were handled above & beyond what we expected. Because of Mike's quickness and professionalism, both situations were resolved in an expedited manor with positive results that we were extremely pleased with. Our granddaughter is also extremely pleased with the results. We would recommend {Mike} Tamou Law Group to anybody that is seeking legal advice in a criminal situation.
TSTed SchroederGoogle review · Jul 2026I had an aggravated DUI case class 4 felony. With an extensive criminal record of 7 prior felonies. Mr. Tamou did an outstanding job on my case, he got me the least possible amount of time. He got the prosecutor not to allege any of my priers. I did just 4 months with a probation tail. Other lawyers I spoke with prior to retaining M. Tamou, told me the best they could get, would be a few years in prison, due to my extensive criminal history. Michael said he would fight for me and he delivered. He has relationships with the prosecutors and judges and is a great negotiator. Also he was great with communicating with me throughout the process. Always returned my calls and text messages and kept me informed. I highly recommend him.
PGPaul GonzalezGoogle review · May 2026I had a great experience with Tamou Law! Michael was very helpful. He took the time to explain everything in a way that was easy for me to understand, which made the entire process feel much less overwhelming. He was patient, professional, and always made sure I felt informed and comfortable with each step. I truly appreciated his communication and support throughout! HIGHLY RECOMMEND!
SSandraGoogle review · Apr 2026Michael is truly amazing. I am so happy that I chose him to help me with my legal situation. He is completely trustworthy. Michael was completely transparent and honest throughout the entire process and offered support to me like I was his own family member. He was patient and understanding and prompt in responding to any of my inquiries during my waiting period. His explanations were clear and logical, and I felt beyond comfortable with him. I really appreciate him and the staff in his practice, and I highly recommend him for anyone's legal needs!! Thank you, Michael! You're really the best. I appreciate you!
RLRochelle LeeGoogle review · Feb 2026Our family went through the worst time of our lives! It was wonderful to have Michael on our side fighting for us and giving us the advice we needed to take the right steps. Case Dismissed! Thank you for your hard work, dedication, and support.
RERussell EllisGoogle review · Aug 2026He's the Greatest lawyer we could have ever asked for he put his heart into helping us and we came out with exactly what we wanted! I highly recommend him!
JOJose OrtizGoogle review · Oct 2026⭐️⭐️⭐️⭐️⭐️ I cannot thank Mike Tamou enough for what he did for my family. My son was facing serious charges that could have changed the course of his life forever. From the very beginning, Mr. Tamou treated us with compassion, respect, and honesty. He took the time to explain every step of the process, always making sure we understood what was happening and what to expect. His professionalism and dedication were unmatched. He worked tirelessly on my son’s case, exploring every possible option and fighting for the best outcome. Because of Mike’s skill, expertise, and determination, my son was saved from going to jail and now has the opportunity to move forward and rebuild his life. I am forever grateful for his hard work and would highly recommend Mike Tamou to anyone in need of a strong, knowledgeable, and caring defense attorney. He doesn’t just represent his clients—he truly fight for them.
EHErin HernandezGoogle review · 2025Michael did an amazing job helping my loved one with his case. He was the first call I made and I knew right then how much he truly cared for his clients. I highly recommend Tamou Law to anyone who reads this review. Michael worked extremely hard for us and exceeded my expectations of the outcome. He is compassionate, very knowledgeable, experienced, respected and very fair. He always took the time to take my calls and to listen to questions that we had. He works hard for his clients and is the kind of guy you want on your side. Thanks again Michael. You were a pleasure to work with.
LBLaurie BryantGoogle review · 2024Great experience from start to finish. Professional, responsive, and made a stressful situation much easier. I felt confident the whole time and really appreciated Michael’s support. Highly recommend!
SMShivraj MannGoogle review · Apr 2026Had a situation that Michael helped me through with the best possible outcome. Very responsive and actually cares about his clients.
CJCaleb JohnsonGoogle review · Aug 2026My son was an idiot and was in serious trouble. He was facing prison time. Fortunately, we were referred to Tamou Law Group by trusted friends and we are beyond grateful that we listened. From the onset, Michael helped to put our family at ease. We discussed the charges where Mike provided insight that helped adjust our expectations. Sure enough, it played out nearly exactly like Mike predicted. Mike put a strong case together – which resulted with no jail time! If you find yourself in need of legal representation, you should hire Michael Timou!
AHArmando HernandezGoogle review · 2025I can’t recommend Tamou law group enough. From day one, Micheal took the time to really listen, explained my options in a way that actually made sense, and built a strong strategy that put my mind at ease. The entire team was professional, responsive and genuinely caring throughout the whole process. They fought tirelessly and delivered a result that far exceeded my expectations. If you need a law firm you can trust completely, this is it. Thank you!
BKBryan KingGoogle review · Dec 2025
Why Tamou Law Group for Drug Charges
Most Arizona drug cases begin with a stop and a search, and they are won or lost on whether that search was lawful and whether the lab can prove what was found. We litigate both before we ever talk about a plea.
Diversion and dismissal-track outcomes
Our published results include diversion on narcotic, dangerous-drug and marijuana possession cases, and reduced charges on transportation-for-sale allegations. Where the stop or the lab is weak, we push for an outcome that leaves no conviction.
We know how drug cases are built
Former prosecutors and law enforcement officers on our team have built drug cases for the State. They know the search-and-seizure sequence a stop must follow, the chain-of-custody records a lab must keep, and what happens when either one is missing.
Possession versus sale
The line between possession and possession for sale is the line between probation and real prison exposure, and at or above the statutory threshold amount a for-sale conviction makes prison mandatory. We attack the inference of sale, from text messages to packaging to the weight thresholds, because that is where years of exposure sit.
Published results in this area
| Case | Charges | Outcome |
|---|---|---|
| State v. N.K. | Possession of narcotic drugs and paraphernalia (A.R.S. 13-3408, 13-3415) | Diversion |
| State v. E.T. | Possession of dangerous drugs, paraphernalia and resisting arrest (13-3407, 13-3415) | Diversion |
| State v. Y.T. | Possession of marijuana, paraphernalia and dangerous drugs (13-3405, 13-3415) | Diversion |
| State v. Z.J. | Transportation of dangerous drugs for sale (13-3407) | Reduced charge |
| State v. A.N. | Transportation and possession of narcotic drugs for sale (13-3408) | Reduced charge |
Anonymized outcomes from our case results page. Every case is different; past results do not guarantee a future outcome.
Frequently Asked Questions
Is A.R.S. 13-3417 a separate charge from the drug offense?
Yes. It is a standalone offense with its own elements, charged as its own count alongside the underlying drug felony. Beating one does not automatically beat the other, and a conviction on both means two separate felony convictions rather than a single enhanced charge.
What class of felony is a violation of A.R.S. 13-3417?
A class 4 felony, with one exception. Subsection C provides that if the felony facilitated carries a class 5 or 6 designation, the 13-3417 violation carries the same classification as that facilitated felony. Otherwise the communication count is a class 4 felony regardless of the underlying offense.
Does the statute specifically say text messages are covered?
No. Section 13-3417 uses the definitions in A.R.S. 13-3001 for wire communication and electronic communication, and neither definition names texts, email, or social media by name. Whether a given medium is covered depends on whether it fits those general statutory categories on the facts.
Can I be charged if the drug deal never actually happened?
Possibly. Subsection A expressly reaches using a wire or electronic communication to conspire to commit a felony provision, not only to facilitate a completed offense. Whether particular messages amount to that is a fact question, and it is one of the most contested issues in these cases.
Does each text message count as a separate offense?
The statute does not say so. Nothing in the text of A.R.S. 13-3417 states that each individual communication is a separate offense, so how many counts a prosecutor files, and whether that charging structure survives, is litigated in the individual case rather than dictated by the statute.
What if the phone was shared with family or roommates?
That goes straight to attribution, which the state must prove. A device in a household, a shared account, a borrowed phone, or a prepaid handset with no subscriber name all make it harder to establish that one specific person sent one specific message at one specific time.
What happens to the 13-3417 count if the drug charge is dismissed?
The communication count has a serious problem. Section 13-3417 requires that the communication facilitate the violation of a felony provision or be used to conspire to commit one. If the state cannot prove that underlying felony, the foundation the communication count rests on is gone.
My messages were vague. Can that still be facilitation?
The state will argue yes, and that argument is contestable. Ambiguous messages only become evidence of facilitation once someone supplies an interpretation and a felony to attach it to. Whether an investigator’s reading of coded or ordinary language holds up is a live issue for the defense.
Should I delete messages if I think police are looking at my phone?
No. Deleting after you know about an investigation creates separate criminal exposure for evidence tampering, gives the state a consciousness-of-guilt argument, and destroys the surrounding context your own defense needs to show a message meant something ordinary. Preserve everything exactly as it is.
Should I let detectives look through my phone if I have nothing to hide?
Talk to a lawyer before consenting. Consent hands over years of unrelated data and gives up the warrant-scope challenges you would otherwise keep. Declining to consent is not evidence of guilt, and it preserves your ability to test how any later search was authorized and conducted.
Two Arizona Offices, One Team
We serve all of Maricopa County and the surrounding area, with free, confidential consultations 24/7 by phone and in-person meetings at either office by appointment.
Case Results Disclaimer: The results described on this page are based on specific facts and circumstances and do not guarantee or predict a similar outcome in any future case. Every case is different. Past results do not guarantee future results. No attorney-client relationship is formed by viewing this page or submitting a contact form until a written fee agreement has been signed. Tamou Law Group, PLLC is licensed to practice law in the State of Arizona. This website is for informational purposes only and does not constitute legal advice.
(function() {
function customizeConsultForm() {
var form = document.querySelector('#consult-form');
if (!form) return false;
var fields = form.querySelectorAll('.gfield');
var emailField = null;
var didWork = false;
fields.forEach(function(field) {
var label = field.querySelector('.gfield_label, label');
if (!label) return;
var labelText = (label.textContent || '').trim().toLowerCase();
if (labelText.indexOf('best way to reply') !== -1 || labelText.indexOf('preferred contact') !== -1) {
field.classList.add('tlg-hide-field');
field.querySelectorAll('input').forEach(function(input) {
input.checked = false;
input.removeAttribute('required');
});
didWork = true;
}
if (labelText.indexOf('email') !== -1) {
emailField = field;
field.classList.add('tlg-email-required');
field.querySelectorAll('input[type="email"], input[type="text"]').forEach(function(input) {
input.setAttribute('required', 'required');
input.setAttribute('aria-required', 'true');
});
didWork = true;
}
});
var gform = form.tagName === 'FORM' ? form : (form.querySelector('form') || form.closest('form'));
if (!gform) gform = document.querySelector('#consult-form form, form[id^="gform_"]');
if (gform && !gform.dataset.tlgSourceBound) {
gform.dataset.tlgSourceBound = '1';
var pageUrl = window.location.href;
var pageTitle = document.title || 'Phoenix White Collar Defense Lawyers';
var pagePath = window.location.pathname;
var sourceTag = '[Source: ' + pageTitle.replace(/\s*[,|].*$/, '') + ' | ' + pagePath + ']';
['source_page', 'page_url', 'lander_url'].forEach(function(name) {
var h = document.createElement('input');
h.type = 'hidden';
h.name = name;
h.value = pageUrl;
gform.appendChild(h);
});
var hp = document.createElement('input');
hp.type = 'hidden';
hp.name = 'source_path';
hp.value = pagePath;
gform.appendChild(hp);
function findMessageField() {
var match = null;
form.querySelectorAll('.gfield').forEach(function(field) {
var label = field.querySelector('.gfield_label, label');
if (!label) return;
var t = (label.textContent || '').trim().toLowerCase();
if (t.indexOf('message') !== -1 || t.indexOf('comment') !== -1 || t.indexOf('detail') !== -1 || t.indexOf('describe') !== -1 || t.indexOf('tell us') !== -1 || t.indexOf('your story') !== -1) {
match = field.querySelector('textarea, input[type="text"]');
}
});
if (!match) match = form.querySelector('textarea');
return match;
}
function prependSource() {
var textarea = findMessageField();
if (textarea && textarea.value.indexOf('[Source:') === -1) {
textarea.value = sourceTag + '\n\n' + (textarea.value || '');
}
}
gform.addEventListener('submit', prependSource, true);
var submitBtns = gform.querySelectorAll('input[type="submit"], button[type="submit"], .gform_button');
submitBtns.forEach(function(btn) {
btn.addEventListener('click', function() {
setTimeout(prependSource, 0);
prependSource();
}, true);
});
}
var submitBtn = form.querySelector('input[type="submit"], button[type="submit"]');
if (submitBtn && emailField && !submitBtn.dataset.tlgBound) {
submitBtn.dataset.tlgBound = '1';
submitBtn.addEventListener('click', function(e) {
var emailInput = emailField.querySelector('input[type="email"], input[type="text"]');
if (emailInput && !emailInput.value.trim()) {
e.preventDefault();
emailInput.focus();
emailInput.style.borderColor = '#c62828';
emailInput.style.boxShadow = '0 0 0 3px rgba(198,40,40,.15)';
}
});
}
return didWork;
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', customizeConsultForm);
} else {
customizeConsultForm();
}
var attempts = 0;
var interval = setInterval(function() {
attempts++;
var done = customizeConsultForm();
if (done || attempts > 10) clearInterval(interval);
}, 500);
})();







