Even if I only have the following, I still get no output:
Controller /app/controllers/articles_controller.php
<?php
class ArticlesController extends AppController{
var $name = 'Articles';
function index(){
$this->set('articles', $this->Article->find('all'));
}
function show($id = null){
$this->Article->id = $id;
$this->set('article', $this->Article->read());
}
function add(){
if(!empty($this->data)){
if($this->Article->save($this->data)){
$this->flash('Your article was successfully created!', '/
articles');
}
}
}
}
?>
View /app/views/articles/add.ctp:
<?php
echo $form->create('Article');
echo $form->input('title');
echo $form->input('body', array('rows' => '3'));
echo $form->end('Save Post');
?>
Here is /app/views/layouts/default.ctp
<?php echo $content_for_layout ?>
HTML Output:
<form id="ArticleAddForm" method="post" action="/cake/articles/
add"><fieldset style="display:none;"><input type="hidden"
name="_method" value="POST" /></fieldset><div class="input
text"><label for="ArticleTitle">Title</label><input name="data[Article]
[title]" type="text" maxlength="255" value="" id="ArticleTitle" /></
div><div class="input textarea"><label for="ArticleBody">Body</
label><textarea name="data[Article][body]" cols="30" rows="3"
id="ArticleBody" ></textarea></div><div class="submit"><input
type="submit" value="Save Post" /></div></form>
On Nov 10, 4:27 pm, jm <[EMAIL PROTECTED]> wrote:
> Here is what I have in its entirety:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head>
> <title>Articles</title>
> </head>
>
> <body>
>
> <h1>Add Article</h1>
> <form id="ArticleAddForm" method="post" action="/cake/articles/
> add"><fieldset style="display:none;"><input type="hidden"
> name="_method" value="POST" /></fieldset><div class="input
> text"><label for="ArticleTitle">Title</label><input name="data[Article]
> [title]" type="text" maxlength="255" value="" id="ArticleTitle" /></
> div><div class="input textarea"><label for="ArticleBody">Body</
> label><textarea name="data[Article][body]" cols="30" rows="3"
> id="ArticleBody" ></textarea></div><div class="submit"><input
> type="submit" value="Save Post" /></div></form>
>
> </body>
> </html>
>
> On Nov 10, 4:18 pm, TommyO <[EMAIL PROTECTED]> wrote:
>
> > This is NOT a problem with cake. Html is 100% client-side, and the
> > html cake generated is proper, as you've proven by pasting in a text
> > file and opening locally. You have NOT provided enough info, as I
> > mentioned in the invalid ticket you keep reopening.
>
> > The problem is likely that you have bad html somewhere BEFORE the form
> > - likely immediately after the H1. Probably an unclosed html tag
> > somewhere. Post the entire rendered page if you want more help.
>
> > On Nov 7, 9:06 pm, jm <[EMAIL PROTECTED]> wrote:
>
> > > I also forgot to mention that I am running CakePHP 1.2.
>
> > > jm wrote:
> > > > When I make a form with CakePHP it does not render in Firefox, almost
> > > > as if it were hidden with CSS. I have removed all stylesheets to
> > > > ensure that this was not the problem.
>
> > > > Here is the PHP code:
>
> > > > <?php
> > > > echo $form->create('Article');
> > > > echo $form->input('title');
> > > > echo $form->input('body', array('rows' => '3'));
> > > > echo $form->end('Save Post');
> > > > ?>
>
> > > > Here is the HTMl it produces:
>
> > > > <form id="ArticleAddForm" method="post" action="/cake/articles/add">
>
> > > > <fieldset style="display:none;">
> > > > <input type="hidden" name="_method" value="POST" />
> > > > </fieldset>
>
> > > > <div class="input text">
> > > > <label for="ArticleTitle">Title</label>
> > > > <input name="data[Article][title]" type="text" maxlength="255"
> > > > value="" id="ArticleTitle" />
> > > > </div>
>
> > > > <div class="input textarea">
> > > > <label for="ArticleBody">Body</label>
> > > > <textarea name="data[Article][body]" cols="30" rows="3"
> > > > id="ArticleBody" ></textarea>
> > > > </div>
>
> > > > <div class="submit">
> > > > <input type="submit" value="Save Post" />
> > > > </div>
>
> > > > </form>
>
> > > > If I save the HTML output to a local HTML file and open it in Firefox,
> > > > I am able to see the form. If I display this form dynamically with
> > > > Cake via localhost/articles/add the only thing I see on the page is
> > > > the H1 tag and the CakePHP debug output.
>
> > > > If I browse to localhost/articles/add in Internet Explorer, it renders
> > > > the form just fine.
>
> > > > Has anyone had this problem or know a fix?
>
> > > > My details are:
>
> > > > Windows XP SP3
> > > > Apache 2
> > > > MySQL 5.0.67
> > > > PHP 5.2.6
> > > > Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/
> > > > 2008092417 Firefox/3.0.3
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---