Hello, I’m a student who is experiencing this new framework. I need help … how do I link a form with another with a button? For example, I have a form ANAGRAFE that is connected with other forms depending on what I choose STUDENT OR TEACHERS(for example) … what can I do? If anyone knows I can say as has already solved the problem? Thank you…
Speaking generally I suppose that a way is at the post page of the form will be shown the form that you want with
if ($_post['element']=='teacher')... form1....else if ($_post['element']=='student') form2
You may check in controller and pass a variable to the model to show the form
In the form where I put the button?
Sorry but I am new and have not got much practice with this framework
Simple php logic, Either display two different forms to the teachers and students or display the button/fields based on the type of visitor viewing the form.
No, sorry maybe I was not clear … I have a form and when I click on the button I should upload another form.Now say that I have an initial menu of options to choose and for both student and teacher I have the same initial form.
How can I do to make me load the correct form when i click the button at the end of the first form which redirect me to student form or teacher form?
<div class="row buttons">
<?php //echo CHtml::button('salva', array('submit' => 'docente/create')); ?>
<?php echo CHtml::button('Button Text', array('submit' => 'studente/create')); ?>
<?php //echo CHtml::submitButton('create',$this->renderPartial('studente/create', array('model'=>$model))); ?>
</div>
Which of these is correct? If I pass the controller does not work I do not find the address of the page.
I am not sure if i got this right, But you are trying to submit the same form based on the type of person viewing/submitting it if it’s a teacher or a student?
How do you know that user is teacher or student?
If you can find it you can see the first answer.
So the 2 forms will be at the same page and with an if you will show 1.
it depends on if it’s a teacher or a student? how can I do? I put an id in the button ?It’s possible?
Probably with some JS but you can display two different forms for the two different people (studen/teacher) and each one will submit it differently. In that case you will need to use some JS to show/hide the forms based on the viewer. You can use CTabView and a simple JS function to display the appropriate form based on the viewer. What do you have so far?
I believe that I use CTabView.I just read the official guide the classe.You can see some example? Thanks …
You mean if i can show some examples?
Yes…if you have just some example…because i have difficult to difficult to find examples about the framework Yii