problem s formularem na wedosu

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
vosy
Člen | 532
+
0
-

ahoj v sablone amm formular ukoncen znackou {/form emailForm} a presne v tomto miste se mi zobrazi chyba error 500
a v logu mam

session_start(): session_start(): Cannot send session cookie – headers already sent by (output started at /data/web/virtuals/68601/virtual/temp/cache/_Nette.FileTemplate/_templates._layout.phtml-3d153c9362856996a1e817786d18cbca.php:26)

Tomáš Votruba
Moderator | 1114
+
0
-

Ahoj, zkoušels použít {/form}? Jak to dopadá?

vosy
Člen | 532
+
0
-

dopada to stejne, ale zkusim znova

vosy
Člen | 532
+
0
-

v sablone

<div class="text-left">
                {form emailForm class=>""}
                <div class="contactForm">
                    <div n:if="$form->hasErrors()">
                        {control emailForm errors}
                    </div>

                    <div class="module-box form-horizontal row-fluid">
                        <div>
                            {input jmeno class=>"text span10"}
                        </div>
                        <div>
                            {input zprava class=>"text span10"}
                        </div>
                        <div>
                            {input email class=>"text span6"}
                            {input odeslat class=>"button radius span4"}
                        </div>
                    </div>
                </div>
                {/form}
            </div>

a v tovarnicce

public function defaultForm($opt=array())
    {
        $parent = $opt['parent'];

        $fData = array('presenter'=>$parent,
                        'name'=>'emailForm');

        $form = new MyForm($fData);

        $form->addGroup();

        $that = $this;

        $form->setAction($form->getAction().'#contactTab');

        $form->addText('jmeno', $that->trans($parent, 'formJmeno'))
                ->setAttribute('placeholder', 'Napište své jméno')
                ->setRequired($that->trans($parent, 'formJmenoRequired'));

        $form->addText('email', $that->trans($parent, 'formEmail'))
                ->addRule(Form::EMAIL, $that->trans($parent, 'formEmailRule'))
                ->setAttribute('placeholder', 'Jaký je Váš email?')
                ->setRequired($that->trans($parent, 'formEmailRequired'));

        $form->addTextArea('zprava', $that->trans($parent, 'formZprava'))
                ->setAttribute('placeholder', 'Vzkaz pro nás')
                ->setRequired($that->trans($parent, 'formZpravaRequired'));


        $form->setCurrentGroup(NULL);


        $form->addSubmit('odeslat', $that->trans($parent, 'formOdeslat'));

        $form->addSubmit('storno', $that->trans($parent, 'formStorno'))
                ->setValidationScope(FALSE)
                ->onClick[] = callback($that, 'emailFormStorno');

        $form->addProtection($that->trans($parent, 'formProtection'));


        $form->onValidate[] = array($that, 'emailFormValidate');

        $form->onSuccess[] = callback($that, 'emailFormOdeslat');

        return $form;
    }

html vysledek

            <div class="text-left">
<form action="/forex-robot-umela-inteligence4x4/?do=emailForm-submit#contactTab" method="post" id="frm-emailForm" novalidate="novalidate" class="">                <div class="contactForm">

                    <div class="module-box form-horizontal row-fluid">
                        <div>
                            <input type="text" name="jmeno" placeholder="Napište své jméno" id="frm-emailForm-jmeno" required data-nette-rules='[{"op":":filled","msg":"Napište své jméno"}]' value="" class="text span10">
                        </div>
                        <div>
                            <textarea name="zprava" placeholder="Vzkaz pro nás" id="frm-emailForm-zprava" required data-nette-rules='[{"op":":filled","msg":"Napište nám vzkaz"}]' class="text span10"></textarea>
                        </div>
                        <div>
                            <input type="text" name="email" placeholder="Jaký je Váš email?" id="frm-emailForm-email" required data-nette-rules='[{"op":":filled","msg":"Jaký je Váš email"},{"op":":email","msg":"contacts.formEmailRule"}]' value="" class="text span6">
                            <input type="submit" name="odeslat" id="frm-emailForm-odeslat" value="Odeslat" class="button radius span4">
                        </div>
                    </div>
                </div>
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="robots" content="noindex">
<script>document.body.innerHTML = ''</script>
<style>
	body { color: #333; background: white; width: 500px; margin: 100px auto }
	h1 { font: bold 47px/1.5 sans-serif; margin: .6em 0 }
	p { font: 21px/1.5 Georgia,serif; margin: 1.5em 0 }
	small { font-size: 70%; color: gray }
</style>

<title>Server Error</title>

<h1>Server Error</h1>

<p>We're sorry! The server encountered an internal error and
was unable to complete your request. Please try again later.</p>

<p><small>error 500</small></p>

a v logu

Nette\InvalidStateException

session_start(): session_start(): Cannot send session cookie – headers already sent by (output started at /data/web/virtuals/68601/virtual/temp/cache/_Nette.FileTemplate/_templates._layout.phtml-3d153c9362856996a1e817786d18cbca.php:26)

<div>
50:                                <?php echo $_form["email"]->getControl()->addAttributes(array('class'=>"text span6")) ?>
51:
52:                                <?php echo $_form["odeslat"]->getControl()->addAttributes(array('class'=>"button radius span4")) ?>
53:
54:                            </div>
55:                        </div>
56:                    </div>
57:    <?php Nette\Latte\Macros\FormMacros::renderFormEnd($_form) ?>
58:                </div>
59:            </div>
60:        </div>

chyba je presne na znacce kde se uzavira FORM :(

Editoval vosy (9. 5. 2014 12:14)

xciza
Člen | 194
+
+1
-

Taky jsem měl tento problém. „Chyba“ je v:

$form->addProtection($that->trans($parent, 'formProtection'));

Budto protection smaz nebo nastartuj session například ve startup metode.

vosy
Člen | 532
+
0
-

husty, il jsem v domeni ze session mam nastartovane.

dix