Hi, Iāve been trying to look for dynamically added field examples online but didnāt have much luck except for paid solutions on the store. What Iām trying to achieve simply is a textbox, that can be added and removed as this isnāt always a fixed amount. Is there anywhere in the documentation that would help me achieve this?
Not directly answering your question, but wouldnāt it be more in line with the architecture to simply use a related module, and a subpanel for that?
You want a variable number of items in a record - thatās a one-to-many relationship, and in SuiteCRM that is handled with related modules and subpanels.
Even if you really need to do something different, something extra, I would still recommend starting from that base and elaborating from there.
Hey pgr,
Thatās a pretty good idea, hadnāt thought of that - Iāll test it out and see how it looks. The reason that I would like to do it the other way is mostly because it would look better, and because there is more than likely fields that will be in different places on my moduleās edit view. I usually havenāt been messing much with UI other than studio and css, most everything I do is in APIs so front end is usually a mystery to me with template engines and such
Try it, Iām almost sure it will work out for you. Working with the architecture, instead of against it, saves you a ton of problems.
You might have a few details to iron out, which you can probably do with customizations, but Iām confident youāll discover that the advantages and simplicity of using a standard solution will outweigh them.
Doing this has the desired functionality I wanted, but I was wondering if there was any way I can get a subpanel onto the edit view? It can be tedious having to go to detail view to finish the rest of your data entry. I saw you had replied to someone about this topic a couple of years ago in a post saying how this wouldnāt allowing saving of the record properly - is this still the case?
I read about it on this blog: subpanel in edit view
Nothing has changed in SuiteCRM since that time, in this regard.
That blog post seems to provide a solution. Also make sure your users know how to use inline edit (double-clicking field to edit them directly in detail or list views).
That was a lot simpler than I thought it was going to be thanks for the subpanel idea. This is what I changed in case anyone needs to do this:
I created a new āview.edit.phpā in /custom/modules/{moduleName}/views/ (I had to create the views folder)
if (!defined('sugarEntry') || !sugarEntry)
{
die ('Not A Valid Entry Point');
}
class {moduleName}ViewEdit extends ViewEdit
{
public function __construct(){
parent::__construct();
$this->options['show_subpanels'] = true;
}
}