小编use*_*758的帖子

我如何在 selectize.js 中设置选定的选项值

我正在尝试设置要在 selectize.js 中选择的选项,如何做到这一点。

有一些选项可以初始设置。那我该如何设置该值。

 <select id="selectize">
   </select>
var options=[
    {value:0, text:"option 0"},
    {value:1, text:"option 1"},
    {value:2, text:"option 2"},
    {value:3, text:"option 3"},
];


$('#selectize').selectize({
    "options":options
});

$('#selectize').change(function(){
//$('#result').html("you select value="+$(this).val());
        $('#selectize').val(1);

});
Run Code Online (Sandbox Code Playgroud)

请在jsfiddle中找到代码

http://jsfiddle.net/rcun9zmf/

谢谢,

html javascript selectize.js

5
推荐指数
1
解决办法
2万
查看次数

致命错误:在原则中对null调用成员函数getId()

我说错了,

Fatal error: Call to a member function getId() on null.
Run Code Online (Sandbox Code Playgroud)

但是我如何检查元素,这是我的代码

$infoArray['groupId'] = $info->getId();
$infoArray['name'] = $info->getName();
$infoArray['addressLine1'] = $info->getAddressLine1();
$infoArray['addressLine2'] = $info->getAddressLine2();
$infoArray['isActive'] = $info->getActive();
$infoArray['countryId'] = $info->getCountry()->getId(); //Here is my error line
$infoArray['countryName'] = $info->getCountry()->getName();
$infoArray['stateId'] = $info->getState()->getId();
$infoArray['stateName'] = $info->getState()->getName();
$infoArray['cityId'] = $info->getCity()->getId();
$infoArray['cityName'] = $info->getCity()->getName();
$infoArray['areaId'] = $info->getArea()->getId();
$infoArray['areaName'] = $info->getArea()->getName();
$infoArray['zipcode'] = $info->getZipcode();
Run Code Online (Sandbox Code Playgroud)

php symfony doctrine-orm zend-framework2

3
推荐指数
1
解决办法
1万
查看次数

php异常没有捕获

我试图捕获异常,但无法,只是收到错误消息

try{
    echo 'test';
    require_once "jj.php";
    return true;
} catch (Exception $ex) {
    throw new Exception("error occured");
}



 Warning: require_once(jj.php): failed to open stream: No such file or directory in C:\xampp\htdocs\corporate-wellness\module\Survey\src\Survey\Repository\QuestionRepository.php on line 
Run Code Online (Sandbox Code Playgroud)

php exception-handling

-1
推荐指数
1
解决办法
41
查看次数