Heng Sopheak Heng Sopheak - 3 years ago 301
HTML Question

Shorthand property name are not supported by current Javascript version in PHPStorm

I have used Jquery getScript and generate html form by Javascript however I got
Shorthand property name are not supported by current Javascript version in PHPStorm but my function work as well.

Concern: Before I used PHP to generate html form within another PHP framework but I think I should not used Server script to do that I should use JS to do that but I don't know how is it going on and is it support all browser or not so please give me some idea of this technique because I not yet understand much more about suing DOM and its performance.

Security Concern: if I used Javascript to generate Html form as below script it will less security or bad performance or not?

Another hand if I keep this code inside of HTMl I will never got this errors types.

$(document).ready(function () {

function returnTill(returnTill) {

var chief_opt = '';
var teller_opt = '';
async: false,
success:function (data, status) {
$.each(data, function(ins, vals){
if(ins === 'chief') {
cheifs = data.chief;
for(var key in cheifs){
chief_opt += '<option value="'+vals[key].id+'"> '+vals[key].username+' / '+vals[key].account_no+' </option>';
}if(ins === 'teller') { /* Tellers*/
tellers = data.teller;
for(var key in tellers){
teller_opt = '<option value="'+vals[key].id+'"> '+vals[key].username+' / '+vals[key].account_no+' </option>';
idSelector: returnTill,
title: 'Return Till',
labels: ['From','To','Amount','Description'],
forms: {
input: {
selection: {
from:{chief_opt,class:'form-control', name:'retn_chief', id:'retn_chief'},
to:{teller_opt, class:'form-control', name:'retn_teller', id:'retn_teller'},
Amount :{type: 'text', name: 'retn_amount', class: 'form-control', Id: 'retn_amount', placeholder: '', style: '', value:''},
token:{ type: 'hidden', name: '_token', class: 'form-control', Id: 'token', placeholder: '', style: '', value: '{{csrf_token()}}'},
textarea : {
description:{class:'form-control', name:'tran_descr', rows:10, id:'tran_descr'}
},script: [

},error: errorCallback,


enter image description here

Answer Source

You can fix it this way:

from:{chief_opt: chief_opt}

So, if you change your code to this:

from:{chief_opt: chief_opt, class:'form-control', name:'retn_chief',  id:'retn_chief'},
to:{teller_opt: teller_opt, class:'form-control', name:'retn_teller', id:'retn_teller'},

You shouldn't get anymore the PHPStorm error.

Hope it helped or at least cleared a little bit. ;)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download