Hi Yakout RAMZI
Thank you for posting your question in the Microsoft Q&A forum
In SharePoint, the double-click behavior on a list row is a built-in feature that automatically opens the item’s edit form. This behavior is "by design" and cannot be disabled or customized using JSON formatting or HTML-based methods.
This limitation exists because SharePoint’s JSON formatting is strictly declarative, it allows for styling and configuring UI elements, but does not support scripting or event handling (such as JavaScript). As a result, native browser or SharePoint events like double-clicks cannot be intercepted or overridden.
For more details, refer to the following official Microsoft resources:
- Use view formatting to customize SharePoint | Microsoft Learn
- SPO List view where users cannot click the list item but only select it - Microsoft Q&A
To address this, we’ve implemented logic that ensures the following:
- The action button only becomes active when all required fields are completed and the item’s status is not already set to "Validé".
- If these conditions are not met, the button is displayed in yellow and is fully disabled for single-click interactions.
- We use pointer-events: none and customRowAction: "none" to effectively block any unintended actions or updates.
Below is the JSON formatting applied to the view to control the button behavior:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"role": "button"
},
"style": {
"background-color": "=if([$Statut] == 'Validé', '#d6d6d6', if([$NomMedicament] && [$DateExpiration] && [$CodeProduit] && [$Fournisseur] && [$MedecinResponsable] && [$Posologie] && [$RemiseTotale] && ([$MotifPrescription] || [$TypeTraitement] == 'Traitement Prolongé' || [$TypeTraitement] == 'Traitement Ponctuel'), '#28a745', '#ffc107'))",
"color": "white",
"font-weight": "bold",
"border-radius": "6px",
"padding": "6px 12px",
"cursor": "=if([$Statut] == 'Validé', 'not-allowed', if([$NomMedicament] && [$DateExpiration] && [$CodeProduit] && [$Fournisseur] && [$MedecinResponsable] && [$Posologie] && [$RemiseTotale] && ([$MotifPrescription] || [$TypeTraitement] == 'Traitement Prolongé' || [$TypeTraitement] == 'Traitement Ponctuel'), 'pointer', 'not-allowed'))",
"pointer-events": "=if([$Statut] == 'Validé', 'none', if([$NomMedicament] && [$DateExpiration] && [$CodeProduit] && [$Fournisseur] && [$MedecinResponsable] && [$Posologie] && [$RemiseTotale] && ([$MotifPrescription] || [$TypeTraitement] == 'Traitement Prolongé' || [$TypeTraitement] == 'Traitement Ponctuel'), 'auto', 'none'))"
},
"txtContent": "Envoyer Validation",
"customRowAction": {
"action": "=if([$Statut] != 'Validé' && [$NomMedicament] && [$DateExpiration] && [$CodeProduit] && [$Fournisseur] && [$MedecinResponsable] && [$Posologie] && [$RemiseTotale] && ([$MotifPrescription] || [$TypeTraitement] == 'Traitement Prolongé' || [$TypeTraitement] == 'Traitement Ponctuel'), 'setValue', 'none')",
"actionInput": {
"Statut": "=if([$Statut] != 'Validé' && [$NomMedicament] && [$DateExpiration] && [$CodeProduit] && [$Fournisseur] && [$MedecinResponsable] && [$Posologie] && [$RemiseTotale] && ([$MotifPrescription] || [$TypeTraitement] == 'Traitement Prolongé' || [$TypeTraitement] == 'Traitement Ponctuel'), 'En Cours', [$Statut])"
}
}
}
We hope the details provided will assist you effectively.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.