# onRender and Developer Issues

**URL:** <https://forum.servoy.com/t/onrender-and-developer-issues/14603>\
**Category:** Classic Servoy\
**Created:** [September 7, 2011, 8:18pm UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603 "2011-09-07T20:18:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![monetteboy](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@monetteboy](https://forum.servoy.com/u/monetteboy)\
**Post date:** [September 7, 2011, 8:18pm UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603/1 "2011-09-07T20:18:30Z")

</div>

I’m having an issue in developer with elements that have an onRender event attached.

If I open a form that has elements with an onRender in the developer client and then make any changes to that form in developer I start getting errors in the console and a popup warning.  
The error says  
“TypeError: Cannot read property “net\_ppe” from (C:\Servoy\servoy\_workspace6final\stock\_tracker\forms\active\_op\_stock\_data.js#18)  
at C:\Servoy\servoy\_workspace6final\stock\_tracker\forms\active\_op\_stock\_data.js:18 (onRender)”

If I take off the onRender events then everything works fine. Sometimes though it gets stuck in a loop and makes me force quit Servoy.

When running just the client the onRender works fine with no errors.

Before I submit a case I was wondering if anyone else had this issue or if it was just something local to my install.

I’m using Servoy 6, Win 7 64-bit and Java 26.

Thanks

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [September 13, 2011, 1:21pm UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603/2 "2011-09-13T13:21:01Z")

</div>

please submit a case.

---

<div class="post-metadata">

**Author:** ![rtiterle](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rtiterle](https://forum.servoy.com/u/rtiterle)\
**Post date:** [November 21, 2011, 4:07am UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603/3 "2011-11-21T04:07:16Z")

</div>

I am having exactly the same issues with the OnRender event. I am trying to attach a procedure to the form onRender event to do conditional line colouring. Up to this point I have not been able to get this to work. A typical basic fuction is as follows:

```auto
function onRender(event) 
{
/** @type {JSRecord<db:/sql1_track_data/rsp_fees>}*/
var rec = event.getRecord()

	if (event.isRecordSelected()) {
		event.getRenderable().bgcolor = '#009900';
	} else if (rec.equity >= 100000) {
		event.getRenderable().bgcolor = '#98c6f3';
	} else {
		event.getRenderable().bgcolor = '#8b9eed';
	}
}

```

The issue is with the record field access. if there is any reference to the record in the function, the error is thrown:

Cannot read property “equity” from (C:\Servoy6\_Workspaces\RT\_Master\_1\Advisor\_Services\forms\ViewRelatedAccounts\_sin.js#48)

Am I doing something wrong or is there a workaround for this??

Thanks,

Rob.

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [November 21, 2011, 8:24am UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603/4 "2011-11-21T08:24:47Z")

</div>

Hi Rob,

for ‘line colouring’ I’d recommend using the CSS.  
If you take a look at the sample CSS (this is an option when you create a stylesheet), you will see classes for even/odd/selected.

---

<div class="post-metadata">

**Author:** ![rtiterle](https://avatars.discourse-cdn.com/v4/letter/r/13edae/32.png) [@rtiterle](https://forum.servoy.com/u/rtiterle)\
**Post date:** [November 21, 2011, 8:53am UTC](https://forum.servoy.com/t/onrender-and-developer-issues/14603/5 "2011-11-21T08:53:31Z")

</div>

I actually did forget about using CSS for this, but in most cases I am looking for colouring based on some condition based on the data in the line… css is not going to help here and it is when I am trying to reference the ‘current’ record that the issue comes up. It seems onRender on a form is not binding the record being processed so it is not available as expected after the call to event.getRecord().

I have an application where most lists are colour coded to give a quick visual indication of the status of each record, so for this reason I have not been able to migrate to v6… yet.

I certainly will use CSS for any more basic needs though.

Thanks!

Rob.
