Page 1 of 1
disable row editing if a field is equal to....
Posted: 2019-04-08 14:29
by G Belgrado
In table view
I would like to create a function to disable line editing
if a field contains a certain value
TABLE_1
if field_2 = "closed"
disable editing of the whole row.
The detail view can only be opened as a print preview
Can someone help me?
thanks
Re: disable row editing if a field is equal to....
Posted: 2019-04-08 21:37
by pbottcher
Hi,
you can try this:
$j('td.TABLE-FIELD :contains({VALUE})').parent().find('a').each(function () { $j(this).removeAttr("onclick").removeAttr("href") } )
Where you replace TABLE, FIELD and VALUE according to your needs
Re: disable row editing if a field is equal to....
Posted: 2019-04-09 08:30
by G Belgrado
Hi pböttcher,
First of all, thank you for your time
Does not work
the table is "Richieste" and the field is "stato_rich"
I created the "Richieste-tv.js" file in the hooks folder
and I entered:
Code: Select all
$j(function() {
$j("td.Richieste-stato_rich :contains('In Attesa')").parent().find("a").each(function () { $j(this).removeAttr("onclick").removeAttr("href") } );
$j( "td.Richieste-stato_rich:contains('In Attesa')" ).css( "text-decoration", "underline" );
});
the second $j() it works
Re: disable row editing if a field is equal to....
Posted: 2019-04-09 08:45
by G Belgrado
I'm sorry
was the space between stato_rich and colon
now works
thanks again
Re: disable row editing if a field is equal to....
Posted: 2019-04-10 09:33
by sjohn
I have a question to this :
Should also not something be done in the detail-view?
I guess that mouse (left) click is disabled if record contains a certain value. But what if user right-click and then "pick" the link-address/URL, and opens this in a new tab - will the user then not see the detail view?
Re: disable row editing if a field is equal to....
Posted: 2019-04-10 10:31
by G Belgrado
nothing is happening
disabling "href"
the links of the whole row become normal text
Re: disable row editing if a field is equal to....
Posted: 2019-04-10 10:42
by G Belgrado
only by manually changing the ID
in " ....table_view.php?SelectedID= "
With the ID of the disabled row you can open the details page....
but this could only be done by a very skilled user ...
this is not the case for my users ..

Re: disable row editing if a field is equal to....
Posted: 2019-04-10 11:34
by pbottcher
Hi,
yes of course, but this was not part of the question
If you want to disable the DV for a particular setting, you can do this as well via the hooks