Hello,
I use Screen Customization plugin, quite often I use the eval trick to set a default value and I now have a problem for which I don't even know how to look for some information :
For the project entity, I would like to set a default value for the description field depending of the type of the project.
Basically I thought something dirty like $this->idProjectType == 173 ? "Specific default val": "really default val" could work ... but no ...
Can anyone give me some help ?
I think you should use parenthesis for condition
($this->idProjectType == 173) ? "Specific default val": "really default val"
Possibly you can try also to specifically use $value as result
$value=($this->idProjectType == 173) ? "Specific default val": "really default val"
Well, I have the same result in both cases and it does not work 🙁
I imagine this is because my project does not exist yet in the database.
But worse, I tried to look at the code and set the default value to
RequestHandler::getValue('idProjectType');
(why ... because I guess I am tired) ... and now I can't even log anymore to Projeqtor, as I have an error "exception occured at {time of the error}" 🙁 🙁 🙁
... how can I unset this change ?
Looking at the code, I thought there was a verification about the viability of the formula .... but it seems it's not enough .... 🙁
where in the database can I unset this default value ? (I imagine I have to erase a cell in the DB)
So ...
I changed the file model/custom/Project.php to remove this dumb default value (I set it to a single word).
... but I still can’t connect to Projeqtor anymore ... 🙁
what happens ?
To retreive connection, rename file model/custom/Project.php to model/custom/Project.php.old
Post here this file, we'll have a look
OK, my second problem is solved : my stupid default value added a "); in the Project.php so all the end of the file was erroneous.
So back to my first problem ... if anybody knows how to set a default value according to the project type, it would be welcome 🙂