Forum

[SOLVED] Programmat...
 
Notifications
Retirer tout

[SOLVED] Programmaticaly set field to required on status change

5 Posts
3 Utilisateurs
0 Reactions
2,437 Vu
(@antoine1003)
Posts: 36
Trusted Member
Début du sujet
 
[#6841]

Hey,

I would like to set a field of Action object to required when status is changed. I tried to use

dijit.byId("idEfficiency").set('required', 'true');

but it doesn't work.

Is there any way to do it?

Thanks ! 🙂


 
Posté : 24/07/2020 4:00 pm
(@babynus)
Posts: 14952
Membre Admin
 

Hi,

Best way is to use our Screen Customization plugin.


 
Posté : 24/07/2020 4:04 pm
(@antoine1003)
Posts: 36
Trusted Member
Début du sujet
 

Haha :')


 
Posté : 24/07/2020 4:06 pm
(@antoine1003)
Posts: 36
Trusted Member
Début du sujet
 

For the one who are looking for the same thing I found it by my self...
You need to go to SqlElement.php and in function getExtraRequiredFields add the desired field.

For example in my case when an Action status is changed to done I want the field idEfficiency to become required to I wrote :

if (!isset($statusObj) || $statusObj == null) {
    $statusObj = new Status($status);
}
if ($class == 'Action' && $statusObj->id && $statusObj->name == 'done') {
    $result['idEfficiency'] = 'required';
}

 
Posté : 24/07/2020 5:19 pm
Paul Ghobril
(@envergus)
Posts: 46
Trusted Member
 

Still the Screen Customization plugin is the Best way to do it.
Otherwise you need to make a change on code every time you upgrade Projeqtor.


 
Posté : 25/07/2020 9:30 am
Share:
Retour en haut