How do I hide/activate a button on a form?

<div id="clickme1" class="row buttons" >

	&lt;?php echo CHtml::submitButton('Save',array('submit' =&gt; '/tirociniStage/index.php?r=docente/create'),array(&quot;id&quot;=&gt;&quot;studente&quot;)); ?&gt;


I try with this,but don’t work








Can you help me????

$(‘clickme1’) should be $(’#clickme1’)

$(‘studente’) should be $(’#studente’)

Don’t work same…:-(((

Can you help me???

Should I remove the <script>???

Try this code:









<?php echo CHtml::submitButton(‘Save’,array(‘submit’ => ‘/tirociniStage/index.php?r=docente/create’),array(“id”=>“studente”)); ?>

should be

<?php echo CHtml::submitButton('Save',array(

             'submit' => '/tirociniStage/index.php?r=docente/create',


)); ?>

No don’t work…:frowning:

The code is working, but I think the problem is in the logic…

First… do you have in your CSS the class hidden?

.hidden {display:none;}

Second… the submit button when clicked will open a new page so what happens is that you click the button, the button is hidden but then the ‘/tirociniStage/index.php?r=docente/create’ is called and displayed as a new page, so you don’t see any more the page with the hidden button…

maybe to use ajaxSubmitButton ?

  <div id="clickme1" class="row buttons" >

    <?php echo CHtml::ajaxSubmitButton('Save','','',array(


    )); ?>


but check the parameters… the second one is the URL you need, if it’s empty it means current page

This way when you click the button the button is hidden and the page remains with the hidden button

Hope it helps…

yes i have a class

.hide {display:none;} in my css

No, I need to make a 2 buttons one visible when I call a form and the other botton invisible when I call another form … as I do?

If you have in the javascript code “toggleClass(‘hidden’)”, then the class should be .hidden not .hide