Hi,
I`v got a form with some fileds like this:
field1
field2
field3
…
field40
I would like to hide them I can use sc_field_display macro but its not funny to write 40x this macro so i tried a loop like this
for ($i=1;$i <={dataset[0][0]}; $i++) {
$name = "field" . $i;
sc_field_display($name,"off");
}
but the source code looking like this:
for ($i=1;$i <=$this->dataset[0][0] ; $i++) {
$nazwa = "exp" . $i;
$this->nmgp_cmp_hidden["name"] = "off";
$this->NM_ajax_info['fieldDisplay']['name'] = 'off';
}
macro sc_field_display doesn`t work with variables… so what now ?
Now we have to wrote in our code:
for ($i=1;$i <={dataset[0][0]}; $i++) {
$name = "field" . $i;
$this->nmgp_cmp_hidden["".$name.""] = "off";
$this->NM_ajax_info['fieldDisplay'][''.$name.''] = 'off';
}
And we got what we want
I suggest to modify sc_field_display macro to work with variables