Question

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.

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top