Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make mandatory field if we select a specific value in picklist
#1
Hi.

I know that we can do this using a custom validations script to my module, like you can read here:
http://corebos.com/documentation/doku.php?id=en:devel:corebos_validation

But I'm not sure if we can do this with Business Maps. Maybe with a combination of Validations and Dependency Business Maps.

Is possible?

In my case I want to make mandatory a date field when we select a concrete value form a picklist.

Thanks,

Omar.
Reply
#2
Hello  Omar,


I think that what you are asking for, can be done using a Validations Map. You can use an Expression for making the field mandatory or if you need to do more complicated validations go on creating a custom function.


I'm writing you here a simple example where an expression is used to make mandatory the field Codice Fiscale when the picklist field  Natura Fiscale contains the value "Ditta Individuale"


Validation Map


<map>
<originmodule>
<originname>Accounts</originname>
</originmodule>
<fields>
<field>
<fieldname>naturafisc_account</fieldname>
<validations>
<validation>
<rule>expression</rule>
<restrictions>
<restriction>Make_CF_Mandatory</restriction>
</restrictions>
</validation>
</validations>
</field>
</fields>
</map>






Expression Map (Make_CF_Mandatory)



<map>

    <expression>if ($(account_id : (Accounts) naturafisc_account)  == 'Ditta Individuale')  then (if ($(account_id : (Accounts) codice_fiscale) != '' or account_id : (Accounts) codice_fiscale) != 0) then 1 else 0 end) else 0 end</expression>
</map>





Let me know if this helps


Elisa
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)