0

I need to have two buttons on my home page, Login and Register. When user click on Login button I need to render a LoginView, while on Register button there will be RegisterView. I see these questions but these also have fields in model(dynamic model):

ActiveForm without model yii2

Yii2 create a form without a model

I don't want to use any model field, I only want to render different view on click event to different buttons. Or in other words, how can I set a button to call specific controller's action on its click event?

How this can be done with Yii2 framework.

Community
  • 1
  • 1
M_Idrees
  • 1,822
  • 1
  • 17
  • 41

1 Answers1

2

Use

<?= Html::a('label', ['/controller/action'], ['class'=>'btn btn-primary']) ?>
Insane Skull
  • 8,810
  • 9
  • 38
  • 59