如何提交yii 2表格onload

Pjax::begin();
$form = ActiveForm::begin();
echo $form->field($model, 'testdata', [
                  'inputOptions' => [
                  'class' => 'form-control input-xsmall input-inline' ],
                  ])->label(Yii::t('app', 'Records : '))
                  ->dropDownList(['10'=> 10, '15' => 15, '20' => 20, '50' => 50], ['onchange'=>"this.form.submit();"]);

ActiveForm::end();
Pjax::end();

The form above allows me to submit form on change event.
How can I make the form submit onload?

You can use onloadFunctions as shown below. You need to define the property inside your controller. Source

<body onload="<?php echo Yii::app()->controller->onloadFunction; ?">

Controller :

class MyController extends Controller
{
     public $onloadFunction='AJavascriptFunction();';
}