0

For some time I have a strange issue: with standard syntax

{{Form :: radio ('somename', 'someval', true, ['adparam' => 'someparam'])}}

the parameter 'checked' does not render on the local host (mac, vagrant / box, laravel 5.4), but it works on a remote server ...

I have already broken the brain, in which direction to dig since I did not even notice the moment when it started work incorrectly (in fact, it worked some time ago)?

UPD: A whole page is realy big, but the piece of code is

{{ Form::radio('certain', '1', true, ['data-case'=>$case->slug]) }} Возможный
{{ Form::radio('certain', '2', false, ['data-case'=>$case->slug]) }} Вероятный
{{ Form::radio('certain', '3', false, ['data-case'=>$case->slug]) }} Характерен для
{{ Form::radio('certain', '4', false, ['data-case'=>$case->slug]) }} Достоверный/Верифицированный

In fact, the issue shows up only when data in the controller matches with a view. If I have $case->certain and radio certain it does not work, but when I change radio name on some like certain2 it works but has no sense, of course. As I mentioned the issue exists only on localhost and just disturb to develop.

UPD: After fighting with debugging tools I have found that servers handle param in different ways. For localhost works:

{!! Form::radio('sex', 0, true) !!}
{!! Form::radio('sex', 1) !!}
{!! Form::radio('sex', 2) !!}

For production works:

{!! Form::radio('sex', '0', true) !!}
{!! Form::radio('sex', '1') !!}
{!! Form::radio('sex', '2') !!}

The Question: where is hidden a setting for this (etc 1!='1')?

  • Any chance you can show us the HTML code that gets rendered on localhost? Ideally the entire
    element if possible.
    – Tudor Apr 28 '18 at 21:16
  • Edit your question with the code and propper code formatting please. – Cagy79 Apr 28 '18 at 21:21

2 Answers2

0

You can't have multiple radio buttons selected. Radio button groups allow a single selection. You need checkboxes in order to accomplish multiple selections.

Tudor
  • 1,798
  • 2
  • 12
  • 21
  • I updated the example above. It does not work if I even use the current value like `$case->certain=='2'?true:false` in the third param... I mean it does not works in any combination (true/false), and this code Works on the remote server... – Oleg Kruglov Apr 28 '18 at 21:48
  • But as only as I change the name of radio button on any name different from data in the controller, it works correctly. – Oleg Kruglov Apr 28 '18 at 21:59
0

The issue comes down to using different database PDO drivers.

Some return ints as strings, others return it as an int. More here

Temp solution is

    'mysql' => [
        'options'   => [PDO::ATTR_EMULATE_PREPARES => true]
    ],

in config in database.php