LaravelCollective / html

HTML and Form Builders for the Laravel Framework
MIT License
4k stars 807 forks source link

How to add additional attribute in option list in laravel blade? #541

Closed anonymouse703 closed 6 years ago

anonymouse703 commented 6 years ago

{!! Form::select('gl_code', [''=>'']+$coa->pluck('coa_info','COAID')->toArray(), old('gl_code', isset($data) ? $data->gl_code: 0), ['id'=>'coa_gl','name'=>'gl_code','class'=>'an-form-control','style'=>'width: 150px;']) !!}

i want to insert 'data-desc'=>'COADesc' in option

e.g

tshafer commented 6 years ago

Insert it with all the other attributes, width etc..

On Jun 17, 2018, at 8:09 PM, anonymouse703 notifications@github.com wrote:

{!! Form::select('gl_code', [''=>'']+$coa->pluck('coa_info','COAID')->toArray(), old('gl_code', isset($data) ? $data->gl_code: 0), ['id'=>'coa_gl','name'=>'gl_code','class'=>'an-form-control','style'=>'width: 150px;']) !!}

i want to insert 'data-desc'=>'COADesc' in option

e.g

Sample — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tshafer commented 6 years ago

{!! Form::select('gl_code', [''=>'']+$coa->pluck('coa_info','COAID')->toArray(), old('gl_code', isset($data) ? $data->gl_code: 0), ['id'=>'coa_gl','name'=>'gl_code','class'=>'an-form-control','style'=>'width: 150px;', data-desc'=>'COADesc']) !!}

anonymouse703 commented 6 years ago

Hi sir, is ->update() method can accept limited request? l

This is a few data no error

DB::table('Sltype') ->where('SLTypeBR_CODE',$brcode) ->where('SLTypeSLC_CODE', $slc) ->where('SLTypeSLT_CODE', $slt) ->update([ 'SLTypeIsDisabled' => $request->SLTypeIsDisabled ? 1 : 0, 'SLTypePriority' => $request->SLTypePriority ? :99, 'SLTypeSLG_CODE' => $request->COAacct_type, 'SLTypeM_DESC' => $request->SLTypeM_DESC, 'SLTypeM_DESC2' => $request->SLTypeM_DESC2, 'SLTypeSLG_CODE' => $request->SLTypeSLG_CODE, 'SLTypeIsIncSOA' => $request->SLTypeIsIncSOA ? 1 : 0, 'SLTypeIsIncFO' => $request->SLTypeIsIncFO ? 1 : 0, 'SLTypePB_FLAG' => $request->SLTypePB_FLAG ? 1 : 0, 'SLTypePBTYPE' => $request->SLTypePBTYPE, 'SLTypeIsConsoPassbkPrinting' => $request->SLTypeIsConsoPassbkPrinting ? 1 : 0, ]);

but

DB::table('Sltype') ->where('SLTypeBR_CODE',$brcode) ->where('SLTypeSLC_CODE', $slc) ->where('SLTypeSLT_CODE', $slt) ->update([ 'SLTypeIsDisabled' => $request->SLTypeIsDisabled ? 1 : 0, 'SLTypePriority' => $request->SLTypePriority ? :99, 'SLTypeSLG_CODE' => $request->COAacct_type, 'SLTypeM_DESC' => $request->SLTypeM_DESC, 'SLTypeM_DESC2' => $request->SLTypeM_DESC2, 'SLTypeSLG_CODE' => $request->SLTypeSLG_CODE, 'SLTypeIsIncSOA' => $request->SLTypeIsIncSOA ? 1 : 0, 'SLTypeIsIncFO' => $request->SLTypeIsIncFO ? 1 : 0, 'SLTypePB_FLAG' => $request->SLTypePB_FLAG ? 1 : 0, 'SLTypePBTYPE' => $request->SLTypePBTYPE, 'SLTypeIsConsoPassbkPrinting' => $request->SLTypeIsConsoPassbkPrinting ? 1 : 0, 'SLTypeMealAllowanceCreditLimit' => $request->SLTypeMealAllowanceCreditLimit ? 1 : 0, 'SLTypeIncludeChargePayment' => $request->SLTypeIncludeChargePayment? 1 : 0, 'SLTypeAddOnIntSalesChargePay' => $request->SLTypeAddOnIntSalesChargePay ? 1 : 0, 'SLTypeMultiplesAmount' => $request->SLTypeMultiplesAmount, 'SLTypePayrollCode' => $request->SLTypePayrollCode, 'SLTypeTERMS' => $request->SLTypeTERMS_ar, 'SLTypeTERM_PERD' => $request->SLTypeTERM_PERD_ar, 'SLTypePPMT_MODE' => $request->SLTypePPMT_MODE_ar, 'SLTypeFirstDueDateGP' => $request->SLTypeFirstDueDateGP_ar ? 1 : 0, 'SLTypePEN_RATE' => $request->SLTypePEN_RATE_ar, 'SLTypePEN_MODE' => $request->SLTypePEN_MODE_ar, 'SLTypePENGP' => $request->SLTypePENGP_ar ? 1 : 0, 'SLTypeINT_RATE' => $request->SLTypeINT_RATE_ar, 'SLTypeINT_RATE_CODE' => $request->SLTypeINT_RATE_CODE_ar, 'SLTypeAMORTYPE' => $request->SLTypeAMORTYPE_ar, 'SLTypeDIMB_FREQ' => $request->SLTypeDIMB_FREQ_ar, 'SLTypeIPMT_MODE' => $request->SLTypeIPMT_MODE_ar, 'SLTypeDD_FLAG' => $request->SLTypeDD_FLAG_ar, 'SLTypeNDAYS_1YEAR_INTDEPO' => $request->SLTypeNDAYS_1YEAR_INTDEPO_ar ? :365, 'SLTypeSF_RATE' => $request->SLTypeSF_RATE_ar, 'SLTypeMINCOMKR' => $request->SLTypeMINCOMKR_ar, 'SLTypeENCUMPCNT' => $request->SLTypeENCUMPCNT_ar, 'SLTypeCIC_CONTYPID' => $request->SLTypeCIC_CONTYPID_ar, 'SLTypeCIAM_FLAG' => $request->SLTypeCIAM_FLAG_ar, 'SLTypeCPAMO_FLAG' => $request->SLTypeCPAMO_FLAG_ar, 'SLTypeRTI_FLAG' => $request->SLTypeRTI_FLAG_ar ? 1 : 0, 'SLTypeAI_FLAG' => $request->SLTypeAI_FLAG_ar ? 1 : 0, 'SLTypeAUID_FLAG' => $request->SLTypeAUID_FLAG_ar ? 1 : 0, 'SLTypePI_FLAG' => $request->SLTypePI_FLAG_ar ? 1 : 0, 'SLTypeIsTaxFree' => $request->SLTypeIsTaxFree_depo ? 1 : 0, 'SLTypeINT_RATE' => $request->SLTypeINT_RATE_depo, 'SLTypeMIN_BAL' => $request->SLTypeMIN_BAL_depo, 'SLTypeMAXBAL' => $request->SLTypeMAXBAL_depo ? :9999999999, 'SLTypeTERMS' => $request->SLTypeTERMS_depo, 'SLTypeNDAYS_1YEAR_INTDEPO' => $request->SLTypeNDAYS_1YEAR_INTDEPO_depo ? :365, 'SLTypeMaxATMWDLPerDay' => $request->SLTypeMaxATMWDLPerDay_depo, 'SLTypeBMBAL_SF' => $request->SLTypeBMBAL_SF_depo, 'SLTypeDORM_PERD' => $request->SLTypeDORM_PERD_depo, 'SLTypeDORM_SF' => $request->SLTypeDORM_SF_depo, 'SLTypeIsConsoPassbkPrinting' => $request->SLTypeIsConsoPassbkPrinting_depo ? 1 : 0, 'SLTypePBTYPE' => $request->SLTypePBTYPE_depo]);

                 <some code here followed>

i got error here

Thanks.

"We are defined by the choices that we made"

On Mon, Jun 18, 2018 at 11:09 PM, Tom Shafer notifications@github.com wrote:

{!! Form::select('gl_code', [''=>'']+$coa->pluck('coa_info','COAID')->toArray(), old('gl_code', isset($data) ? $data->gl_code: 0), ['id'=>'coa_gl','name'=>'gl_code','class'=>'an-form-control','style'=>'width: 150px;', data-desc'=>'COADesc']) !!}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/LaravelCollective/html/issues/541#issuecomment-398087870, or mute the thread https://github.com/notifications/unsubscribe-auth/Aj5j7ZA4ilmO4-UZeDxBuRR1URYf4yR9ks5t98LDgaJpZM4UrGlB .