Sc field readonly with dinamic values

The macro
sc field readonly( $my_field, on);

Since the June 19 update, it generates an error for the dynamic value of the field

This is the generated code that gives an error

$this->sc_field_readonly($my_field . '_', 'on', (isset($sc_seq_vert) ? $sc_seq_vert : ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['aaa_grupo_apps']['Field_disabled_macro']['my_field . '_''] = array('I'=>array(),'U'=>array());
                                                                                                ^
; 

I tried using global variables, but that doesn’t work either. Any ideas? Thanks.

quick solution with javascript

if (isset( {rs[0][0]} )){
	foreach ({rs} as $fila) {

		$my_field = strtolower($fila[0]);
		//sc_field_readonly( $my_field , on);
	
		//This code replaces the functionality of sc_field_readonly
		echo <<<HTML
		<script>
		  document.addEventListener('DOMContentLoaded', function() {
		  	let campo = document.querySelector("[name='{$my_field}']");
		    campo.readOnly = true;
			campo.disabled = true;
			if (campo.tagName.toLowerCase() === 'select') {
				campo.parentElement.parentElement.parentElement.style.opacity = '0.6';
				campo.parentElement.parentElement.parentElement.style.cursor = 'not-allowed'; 	
			}else{
				campo.parentElement.parentElement.style.opacity = '0.6';
				campo.parentElement.parentElement.style.cursor = 'not-allowed';
			}
			
		  });			
		</script>
		HTML;
		//END This code replaces  sc_field_readonly			
	}		
}

@derazo,

We ran some tests with code that was very similar to yours above, and it worked fine: the first field found in the loop was disabled in the application, as you can see in the image below (interface and application running).

Is there any specific detail that you didn’t identify in the example above that is crucial to simulating the problem? If so, let us know so we can continue.

Best regards!

Hi,
I ran into the same error:

$_SESSION['sc_session'][$this->Ini->sc_page]['adress_details_sub']['Field_disabled_macro']['my_t_field . '_''] = array('I'=>array(),'U'=>array());   

It is clear, that Scriptcase generates a wrong code with two ‘’ in this line.

My function call is:

sc_field_readonly($my_t_field, 'on');

$my_t_field contains the name of a field in the form.

Note: The sc_field_readonly() is used in a function within an internal library. Nothing special else.

The application did run OK with older versions of Scriptcase.

Please publish a fix as soon as possible or make Scriptcase version 9.12.015 available for download and manual installation.

Thank you very much!

Best
Gunter

@GunterEibl,

We also performed a test considering the variable as you sent above, and also within an internal library, calling the function in the onLoad event of the Form application, and the result was the same: normal functioning of the macro passing dynamic values.

We suggest that you contact the tool’s support so that they can investigate in more detail what may be happening in your application.

In any case, if you want to install version 9.12.015 in parallel, you can download it through the link below:

https://downloads.scriptcase.net/v9/packs/scriptcase-9.12.015-php8.1.zip

In any case, we reinforce the importance of requesting support so that you can stay on the latest version.

Best regards!