Support the ongoing development of Laravel.io →
posted 10 years ago
Forms
Last updated 1 year ago.
0

Yes you are right!

Now I have same issue that like yours..

Why do that when input name is a number?

Last updated 1 year ago.
0

I believe the HTML spec indicates that the name attribute of any form inputs must start with a letter.

Last updated 1 year ago.
0

I played with this for a while and ended up using a work around. It is actually quite big flaw if you want to use associative IDs in as a form value.

What I did was a bit of a hack but it works fine. I prefixed everything in the form with 'id:' and then parse it off when processing the form.

$form_data = Input::all();
unset($form_data['_token']);

foreach ($form_data as $elem_name => $elem_val) {
			//need to parse off id: from name because of a bug in laravel that converts numeric form element names to integers when it returns Input::all()
			$pieces = explode('id:', $elem_name);
			$id = $pieces[1];
}
Last updated 1 year ago.
0

"""I believe the HTML spec indicates that the name attribute of any form inputs must start with a letter."""

Perhaps but it is reasonable to assume that people would want an id that corresponds to a database field as the name of form elements. It is common for forms that allows bulk edits of common fields to indicate which rows are being updated in bulk.

If this restriction is by design it is a poor design, I should at least be able to define the datatype as a string to avoid the numerical conversion. 101 != "101"

Last updated 1 year ago.
0

I have created new issue record on Laravel github page at in the night. Please fallow this record. https://github.com/laravel/framework/issues/5235

If I need to do this

$post = Input::all(); //  This make post data to break !
$fixedPost = $_POST; // The line tell  us that why do we use framework :D

This is a bug !

Last updated 1 year ago.
0

Awesome thanks MURAT for reporting it. And thanks to andyfleming for commiting a fix!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

IanSirkit iansirkit Joined 24 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.