dynamic required field

Hi,

I’d like to know, how to set a required field in runtime

Regards,

Re: dynamic required field

onValidate event:

if({field} == ‘’)
{
sc_error_message(“This is a required field!”);
}

?

Re: dynamic required field

Hi,

Diego I’ve already tested that way, I’d like show the message next to the required field, like required field in scriptcase works

regards,

Re: dynamic required field

i believe that you cant do this now.

Pass this as a sugestion to support team.

Hi Integradores,
You can set a required field in runtime using ScriptCase. Please follow these steps:

  1. Create two fields for example, field1 and field2
  2. Create an AJAX event condition for field1, like this one:
if({field1}=='example'){
        // Change the label value of FIELD2  and add a red asterisk 
	sc_label('field2') = "My Label field <b style='color:red'>*</b>";
}else{
        // Restore the label field2 to normal
	sc_label('field2') = "My Label field";
}
  1. In your application OnValidate event :

if({field1} == 'example' and {field2}==''){
sc_error_message("This is a required field!");
}

Note: field2 is dinamically marked as required only when field1 is set to ‘example’.

Can you help is one of the fields is null
Here is what I have

$employment_status = {employment_status};
$termination_date = {termination_date};

if($employment_status == 2 and $termination_date === null){
sc_error_message(“There is no termination date!”);
echo “status:”.{employment_status};
}
else
{
echo “else: status:”.$employment_status;
echo “else: tdate:”.$termination_date;
}

everything goes to else

is this still not possible without doing it manually ?

AFAIK no…