Skip to content
Advertisement

I want to add 94 at the beginning of the very number i insert

I want to add 94 at the beginning of the very number I insert from this input area. This is POS system which is written under laravel framwork.

 <div class="col-md-3">
                <div class="form-group">
                    {!! Form::label('mobile', __('contact.mobile') . ':*') !!}
                    <div class="input-group">
                        <span class="input-group-addon">
                            <i class="fa fa-mobile"></i>
                        </span>
                        {!! Form::text('mobile', null, ['class' => 'form-control', 'required', 'placeholder' => __('contact.mobile')]); !!}
                    </div>
                </div>
            </div>

screenshot of the area

Advertisement

Answer

 <div class="col-md-3">
                <div class="form-group">
                    {!! Form::label('mobile', __('contact.mobile') . ':*') !!}
                    <div class="input-group">
                        <span class="input-group-addon">
                            <i class="fa fa-mobile"></i>
                        </span>
                        {!! Form::text('mobile', '94', ['class' => 'form-control', 'required', 'placeholder' => __('contact.mobile')]); !!}
                    </div>
                </div>
            </div>

You should change second parameter ‘null’ to ’94’ of Form::text, it’s a default value.

You can learn more from laravel’s documentation : https://laravel.com/docs/4.2/html

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement