This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

mario.basic1089
mario.basic1089

I am trying to do

<input name="name" type="text" placeholder="Your Name" value="{{ Input::old('name') }}">

but keep getting this error:

Unexpected token "punctuation" of value ":" ("end of print statement" expected)

Is there a way to retrieve old input for a form? In L5 there is function called old but it is missing here somehow.

Eoler
mario.basic1089
mario.basic1089

So I tried doing input_old but it says:

Unknown "input_old" function.

This is really bothersome. Why are all examples from documentation not working??

Eoler
Eoler

So I tried doing input_old (...) Why are all examples from documentation not working??

The docs state snake case should be used for Html/form facade, so:

<input ... value="{{ form_value('name') }}">

Remember - its October, not Laravel. ;-)

mario.basic1089
mario.basic1089

Eoler said:

So I tried doing input_old (...) Why are all examples from documentation not working??

The docs state snake case should be used for Html/form facade, so:

<input ... value="{{ form_value('name') }}">

Remember - its October, not Laravel. ;-)

So why does input_old not work?

I have figured out a way of working with october by using ajax controller, but now I am curious why does this not work.

jwilson8767
jwilson8767

@mario.basic1089 Twig is a sandboxed language. You must pass it all the data/objects you want it to have access to before you start. see https://octobercms.com/docs/cms/pages#page-variables

In your case use:


//ini section
=========
//code section
public function onStart(){
$this->page['name'] = Input::old('name');
}
=========
<input name="name" type="text" placeholder="Your Name" value="{{ name }}">

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.