This topic is locked
[SOLVED]

  Java onload event

11/8/2012 4:15:18 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Hello,
I have a header table (header)
I want to accomplish that when the table loads it will not show the export button when it has allready been exported,
so: when klaar_export=1 the custom button 'export' may not be visible.
i want to try this in the Java onload event?

Sergey Kornilov admin 11/8/2012

Javascript OnLoad event is not designed for this type of job. It works the best on Add/Edit pages.
Besides that, Javascript OnLoad event will be only fired when whole page is loaded meaning user will see those buttons first and then they disappear at some point. Not the best scenario for the user.
I recommend to use server-side code to display or hide this button based on another field value. Here is how you can do this.

  1. Switch to HTML mode in Visual Editor and add wrappers around button's code:

    Here is the sample code:

{BEGIN MyButton}

<SPAN class=runner-btnframe>

<SPAN class=runner-btnleft></SPAN>

<SPAN class=runner-btnright></SPAN>

<A id=New_Button2 class=runner-button href="#" typeid="ib">New_Button2</A>

</SPAN>

{END MyButton}


2. Now in List page: AfterRecordProcessed event add the following code:

if ($data['YearOfMake']=='2001')

$record["MyButton"]=true;


This code will only display button if YearOfMake field value equals 2001.
This is it.

I
Ivan van Oosterhout author 11/12/2012

Thanks Sergey,
You make mircles happen... It was easy but now i understand the basics of $record[] function.
Regards Ivan