How to pass value to Password field in Laravel

I am trying to extract the value of a password field and display it in the current form for one of the update pages

{{ Form::label('Password')}} 

{{ Form::password('password',array('class' => 'form-control') }}

The syntax of the password field of the Lavar blade does not allow the use of a parameter for input, for example, for text fields,

{{ Form::label('Email or Username')}} 

{{ Form::text('email',$useremaildata,array('class' => 'form-control')) }} 

Now I have found one solution to use placeholders like this, but this is not a ritual way to do this. Sharing only swap.

{{ Form::label('Password')}} 

{{ Form::password('password',array('class' => 'form-control','placeholder' => $userpassworddata)) }}

Any help would be great.

+1
source share
2 answers

The simple answer is that you are not doing this. Password fields rarely need to be pre-populated, and therefore, since this is not a common occurrence, Laravel does not support it.

, , Form::input():

Form::input('password', 'name', 'value')
+6

, . , , , , .

HTML-, .

start/global.php do:

/**
 * Custom macro for a masked password field with a default value
 */
 HTML::macro('passwordWithDefault', function($name, $defaultValue = "", $optionsArray) {    
    return Form::input('password', $name, $defaultValue, $optionsArray);
 });

HTML :

HTML::passwordWithDefault('pwdField', Input::old('pwdField', $pwd_value),['class' => 'form-control'])
+1

Source: https://habr.com/ru/post/1529563/


All Articles