Hi,
Iām looking at detailviewdefs for invoices and I would like to make if statements so that certain panels show up if at certain sales stages; (much like a shopping transaction on an e-commerce website).
For example, an enquiry would start at the first stage and only show basic info/first panel, and then the user clicks a next button on the bottom left and the basic info is hidden and the next section is shown.
I roughly know how to code the logic but how would I fit this into the arrays?
Thanks
Would it not be better to do this with JavaScript? For example have a all the panels and fields showing as they are then add JavaScript to the view to hide panels. When certain options or buttons are clicked the hidden panels could be shown or hidden etcā¦ I donāt think its possible to do it the way you are suggesting at least not without major reworking of the entire module.
No! You obviously didnāt read the link I gave you properly.
As I said in the link I gave you. You can add a custom js file to the includes section of the editview defs or you can create a new view and echo the JavaScript out in php directly into the view.
You cannot add if statements or add JavaScript directly to the ediviewdefs! At least not in the way you are trying to do it.
Ensure you have developer mode enabled in the admin panel. Comment out your JavaScript and just put alert('works); Refresh the page and if the popup appears then the js file is referenced properly and the issue is with your code.