Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » Field turns noedit without apparent cause
Field turns noedit without apparent cause [message #1537] Tue, 12 August 2008 15:12 Go to next message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
I have a table called 'team'.
In this table there is a field entidad_id that has a dropdown list that retrieves data from the 'entidad' table.

If in the team.class.inc I include this code (which I use to filter the records so each 'entidad' can see only their records):
	    function _cm_pre_getData ($where, $where_array, $fieldarray=null){
			require_once 'classes/entidad.class.inc';
			$entidad = new entidad;       
		    $entidad->sql_select = 'entidad_id';
			$entidad_id = $entidad->getData("entidad_id='" .$_SESSION['role_id'] ."'");

			if ($entidad->numrows == 1){
				if (empty($where)){
					$where = "entidad_id=" .$entidad_id[0]['entidad_id'] ;	
				}else{
					$where .= " AND entidad_id=" .$entidad_id[0]['entidad_id'] ;
				}

		    }
			return $where;
	}

then, when adding a new record (logged as an 'entidad') with an add1 transaction in the 'team' table, the entidad_id field becomes a noedit field automatically (I haven't defined it 'noedit' in the dictionary).

For a user that is not an 'entidad' the dropdown list is displayed correctly.

I'm trying to understand what is happening here but can't seem to find the explanation.
Re: Field turns noedit without apparent cause [message #1539 is a reply to message #1537] Tue, 12 August 2008 19:10 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If you stepped through with your debugger you could see exactly what is happening.

It sounds like 'entidad_id' is being passed into the ADD1 task within the $where string. When the 'getInitialData()' method is executed it automatically sets any field in the $where string to 'noedit'.


Re: Field turns noedit without apparent cause [message #1547 is a reply to message #1537] Wed, 13 August 2008 08:55 Go to previous messageGo to next message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
Do you mean the sql debugger?
How can I make this happen also when updating the record?
Re: Field turns noedit without apparent cause [message #1548 is a reply to message #1547] Wed, 13 August 2008 09:32 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
bonzo_bcn wrote on Wed, 13 August 2008 13:55

Do you mean the sql debugger?

No, I mean a PHP debugger so that you can see each line of code as it is being executed. In that way you can see EXACTLY what is happening instead of trying to guess.


Previous Topic: How to change node_desc in Tree_structure (TREE2)
Next Topic: Filter values of fields depending on other fields
Goto Forum:
  


Current Time: Sun Nov 03 08:58:09 EST 2024

Total time taken to generate the page: 0.01526 seconds