Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Grid Row Javascript API > Methods

Grid Row Javascript API: row.getFieldValue()

Scroll Prev Next More

 

row.getFieldValue() gets the current field value on the page. If you used the row.setFieldValue function to adjust the value of the field, row.getFieldValue() will return the adjusted value, and not the one in the database.

 

Note: for getFieldValue() function to work PHPRunner needs to retrieve and store in Javascript the whole data set. This can be a resource-consuming operation and is turned off by default. As an alternative you can use a lightweight getFieldText() function.

 

1. It will be enabled automatically if you have Grid Click Actions on this page or inserted a button into the grid.

 

2. Or to enable it manually you can add the following code to BeforeProcess event of the List page in question:

 

 

$pageObject->addRawFieldValues = true;

 

Syntax

row.getFieldValue(field);

Arguments

field

the name of the field.

Return value

Returns a raw field value without formatting applied.

Example

Click the OrderID field to retrieve the current order total and display it in the OrderID field.

 

Client Before:

 

// pass OrderID to Server event  
params["OrderID"] = row.getFieldValue("OrderID");  

 

Server:

 

// run SQL Query to retrieve order total  
$result["total"] = DBLookup("select sum(Quantity*UnitPrice) from `Order Details` where OrderID=".$params["OrderID"]);

 

Client After:

 

// change cell background  
row.fieldCell("OrderID").css('background', 'yellow' );  
// add order total to OrderID cell content  
row.fieldCell("OrderID").html(  
  row.fieldCell("OrderID").html()+"<br>Total: "+result["total"]);  

See also:

Grid Row JavaScript API: row.fieldCell()

DAL method: DBLookup()

Grid Row JavaScript API: row.setFieldValue()

Search API: getFieldValue()

JavaScriptAPI: addField()

RunnerPage object: hideField()

RunnerPage object: showField()

Tri-part events

About SQL query API

Field events

About Grid Row JavaScript API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software