Skip to content

Instantly share code, notes, and snippets.

@bazo
Last active December 19, 2015 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bazo/5990343 to your computer and use it in GitHub Desktop.
Save bazo/5990343 to your computer and use it in GitHub Desktop.
nette form bug
<form class="ajax" id="frm-formNewMessage" method="post" action="/translation/default/51e0996cb0d02a1425000003"> <label for="frm-formNewMessage-context">Context</label>
<input type="text" value="" id="frm-formNewMessage-context" name="context">
<label for="frm-formNewMessage-singular">Singular</label>
<input type="text" value="" data-nette-rules="[{&quot;op&quot;:&quot;:filled&quot;,&quot;msg&quot;:&quot;Please complete mandatory field.&quot;}]" required="" id="frm-formNewMessage-singular" name="singular">
<label for="frm-formNewMessage-plural">Plural</label>
<input type="text" value="" id="frm-formNewMessage-plural" name="plural">
<input type="submit" class="btn btn-primary" value="Add" name="btnSubmit">
<div><input type="hidden" value="formNewMessage-submit" name="do"></div>
</form>
{form formNewMessage class => "ajax"}
{label context /}
{input context}
{label singular /}
{input singular}
{label plural /}
{input plural}
{input btnSubmit class => "btn btn-primary"}
{/form}
use Nette\Application\UI\Form;
protected function createComponentFormNewMessage()
{
$form = new Form;
$form->addText('context', 'Context');
$form->addText('singular', 'Singular')->setRequired();
$form->addText('plural', 'Plural');
$form->addSubmit('btnSubmit', 'Add');
$form->onSuccess[] = callback($this, 'formNewMessageSubmitted');
return $form;
}
<form id="frm-formNewMessage" method="post" action="/translation/default/51e0996cb0d02a1425000003">
<label for="frm-formNewMessage-context">Context</label>
<input type="text" value="" id="frm-formNewMessage-context" name="context">
<label for="frm-formNewMessage-singular">Singular</label>
<input type="text" value="" data-nette-rules="[{&quot;op&quot;:&quot;:filled&quot;,&quot;msg&quot;:&quot;Please complete mandatory field.&quot;}]" required="" id="frm-formNewMessage-singular" name="singular">
<label for="frm-formNewMessage-plural">Plural</label>
<input type="text" value="" id="frm-formNewMessage-plural" name="plural">
<input type="submit" class="btn btn-primary" value="Add" name="btnSubmit">
</form>
<form n:form="formNewMessage" class="ajax">
{label context /}
{input context}
{label singular /}
{input singular}
{label plural /}
{input plural}
{input btnSubmit class => "btn btn-primary"}
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment