John, I really appreciate you taking the time testing my problem. However,
it still doesn't work for.
The error: document.getElementById("GameAnswerFrom") is nullI think I'm going crazy here but I did found something interesting. When form->create is called, cake adds a hidden input. It also does this for radio buttons. I discovered by mistake that if I leave those hidden fields, I can't run a js scrip for styling radio buttons. So, maybe the same goes here. Is there any way to get rid off that hidden field next to the form? The manual says nothing. Thanks On Sat, Jun 19, 2010 at 9:04 PM, cricket <[email protected]> wrote: > 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]<cake-php%[email protected]>For > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > 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
