문제

I have the following screen in my project.Everthing is working fine other than the redirection link of View.As you can see it is poping up the validation error.I have no idea why its comming.Even,I am redirecting to diffrent model.enter image description here

I want to go the diffrent page when clicking View.

I have the following code in my view.

//codes//
<div class="view" id="id">
    <?php 

                echo "<h4>Name : " .       $value['name']. "</h4>";
                echo "<h4>Skills : " .     $value['key_skills'] . "</h4>";
                echo "<h4>Category : " .   $value['title']. "</h4>";
                echo "<h4>Experience : " . $value['experience'] . " Years.</h4>";
               // echo CHtml::submitButton('View Details', array('name' => 'viewemployeedetails')); 
                echo CHtml::button('View',array(
                     'submit'=>array('SiteContoller/actionViewEmployeeDetails',array('id'=>$value['id'])),
));
     ?>
</div>  

I have tried few things...but its not working.

도움이 되었습니까?

해결책

You have to remove the 'Controller' text part and 'action' text part from:

'SiteContoller/actionViewEmployeeDetails'

and use

'site/viewEmployeeDetails'

if you want it to go to SiteController's actionViewEmployeeDetails action

다른 팁

You should use CHtml::link not CHtml::button unless you are posting data to the address. You can use css to style your link to look and visually behave like a button. In addition there is no submit attribute for button see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top