I tried to do as you, and ended up having to use the code below:
[code]
<script language="javascript">
function myFunction() {
alert('Disables button');
document.getElementById('submit').disabled=true;
alert('Renames button label');
document.getElementById('submit').value='Wait...';
alert('Submitting form');
document.getElementById("ExampleFormidForm").submit();
return false;
}
</script>
<?php echo $form->create('Example', array('action' => 'formid'));?>
<?php echo $form->input('Example.answer', array('type' => 'radio',
'div' => false, 'legend' => false, 'options' => array(0, 1, 2, 3,
4)));?>
<?php echo $form->submit('Answer!', array('id'=>'submit' ,'onClick' =>
'return myFunction();'));?>
<?php echo $form->input('Example.speed', array('type'=> 'hidden'));?>
</form>
[/code]
The example can be tested at:
http://jaa.myftp.org:28880/examples/formid
Address is available until 22 latvian time!
Observe that I use getElementById to retrieve the form! Each step in
the javascript function is preceeded by an alert, so as to allow the
user at my address to observe the change in the submit button.
Can you use the above to get going? :)
Enjoy,
John
On Jun 19, 6:48 pm, Andrei Mita <[email protected]> wrote:
> It all takes place in this view: question.ctp
>
> <? echo $form->create('Game', array('action' => 'answer', 'name' =>
> 'GameAnswerForm','class'=>'iform'));?>
> <input type="radio" value="<?=$options[0];?>" name="answer"
> class="styled"><?=$options[0];?>
> //not using $form->radio because i din't figure out how to remove the div
> which comes with the radio btns
> <?echo '<ul><li>'.$form->submit('Answer!', array('class'=>'itext', 'id'=>
> 'submit')).'</li></ul>';?>
> <?echo $form->input('speed', array('type'=> 'hidden'));?>
> <?echo $form->end();?>
>
> And the submit is in the countdown.js file:
>
> function myFunction() {
> document.getElementById('submit').disabled=true;
> document.getElementById('submit').value='Wait...';
> GameAnswerForm.submit()
>
> }
>
> The code is stripped down from what I think is unnecessary. If needed, I'll
> paste everything in here. Thanks.
>
[snip]
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en