Form (Multiple Records): disable a field(Days), based on its value

Hello everyone,

I have a form (Multiple Records). There is a calculated field called {Days}. If ({Days} > 4), then field {comment} must be disabled.

I did it this way, in the onRecordLoad:

if ({Days} > 4)
	{sc_field_disabled("comment");}
else
	{sc_field_disabled("comment=false");}

Now what happens is this: once the first row {Days} > 4, I get all {comment} fields disabled. If the first row {Days}<= 4, I get all {comment} fields enabled.

What should I do so that the enabling / disabling goes for only the specific rows that match the criteria?

Thanks for replying.

This does not work …

Option might be to use a grid with a link to a form to edit the record, i.e. in a modal form. It will work within a single-record form.

But any other solution is OK: But I want data input can be edited only for 4 days. After that no more edit, but at the same time I want to see several records such as in a grid or Multiple Records.

Hi,
have a look at this thread

http://www.scriptcase.net/forum/showthread.php?6418-form-field-(select)-color-background-color-and-lock!

It’s very similar.

jsb

[QUOTE=jsbinca;29991]Hi,
have a look at this thread

http://www.scriptcase.net/forum/showthread.php?6418-form-field-(select)-color-background-color-and-lock!

It’s very similar.

jsb[/QUOTE]

Hi,

Have got close to the solution.

I have inserted following code in the OnLoadRecord:

sc_ajax_javascript(‘testjs’,array(4));//Just a way to test if can disable partial

I have created Javascript Method called testjs(index):

document.F1[‘id_sc_field_comment_’+index].disabled = true;

The above works, so that every time I click the <Next> navigation button, I get the fourth row {comment} disabled! For each “page” (of 10 records).

Now how do I change above code so that only rows, which match my criteria: if ({Days} > 4) { sc_ajax_javascript(‘testjs’,array(??));}

Is there a way to get the row number each time. I tried hard and, unfortunately, could not at the moment get it.

Thanks for your final help!!

Hi, Try this

sc_field_disabled_record(“comment; column2; column3”); <— For more than one column
sc_field_disabled_record(“comment”); <— For one column

[QUOTE=willian_fernando;29994]Hi, Try this

sc_field_disabled_record(“comment; column2; column3”); <— For more than one column
sc_field_disabled_record(“comment”); <— For one column[/QUOTE]

The criteria {Days} > 4 not taken care of in your proposal…

[QUOTE=willian_fernando;29994]Hi, Try this

sc_field_disabled_record(“comment; column2; column3”); <— For more than one column
sc_field_disabled_record(“comment”); <— For one column[/QUOTE]

Nice one, but where did you find it?
No reference in the docu (yet?).

@michael
onLoadRecord:

if({Days} > 4)
{
sc_field_disabled_record(“comment”);
}

jsb

Most likely on the brazilian forum: http://www.scriptcase.com.br/forum/index.php?topic=7896.0

That rises the question: How many sc-macros are out there I/we have no idea of just because they aren’t mentioned anywhere?

jsb

I would call it undocumented features. Realy don’t know. Not uncommon though. Windows and IOS are full of them…

Yes Sorry :slight_smile:
Forgot to complete. but I’m glad it worked

This code you can see in the security module in the application that enables or disables the applications to users or groups, in my project = app_form_sec_usuarios_apps