On Jun 19, 11:48 am, 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()
>
> }
>
It's the ID of the form element, not the name, that you want to invoke
so there's little point in passing a name option to the form create
method.. Having said that, I do believe that Cake should create the
form with ID GameAnswerForm, as per the model and action.
But your JS looks incomplete. You're referring to a non-existent
variable, GameAnswerForm. It should have:
var GameAnswerForm = document.getElementById('GameAnswerForm');
BTW, have you looked into jQuery? It makes a lot of this stuff much
simpler, with far less repetitive code.
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