yii2

Sum of textboxes in yii2 dynamic form

本小妞迷上赌 提交于 2019-12-12 02:23:42
问题 I'm trying to get sum of all the "Price" textboxes in another textbox "Amount". The textbox for price is ssgi_price and the textbox for Amount is ssg_amount. The intention is whenever I put some value in the Price Textbox, the sum of all price textboxes should populate in the Amount textbox. Like below image - Code of my _form looks like - <div class="container-items"><!-- widgetContainer --> <?php foreach ($modelsSellitemsg as $i => $modelSellitemsg): ?> <div class="item panel panel-default"

Defining the url in yii ajax get

自闭症网瘾萝莉.ら 提交于 2019-12-12 02:14:24
问题 Am trying to perform an ajax get to a yii2 controller but the link fails to pass correctly This is what i have tried: $.ajax({ url: '<?php echo Yii::$app->request->baseUrl. "/checks/items" ?>', //this fails type: 'get', data: { category:category, _csrf : '<?=Yii::$app->request->getCsrfToken()?>' }, success: function (data) { var parsedResult = $.parseJSON(data); ..... $("#labels_trackcenter").html(html); } }); How do i pass that url These are the config url rules: 'urlManager' => [ 'class' =>

yii 2 , make an active form text field master search field

。_饼干妹妹 提交于 2019-12-12 01:46:32
问题 Right, i have a database table that has details on cases. Now the user wants to be able to search for these cases by things like name, year , judgement data ect.. Now i have a working example, however this only works when you search by name in the name field and by year in the year field. You cant for example search for name in the year field. So i want to have a main search field that you can input any string and it will result a row from the database where the search term relates to any

Css and bootstrap in yii2

走远了吗. 提交于 2019-12-12 01:43:16
问题 I'm quite new to Yii2 and I have created a layout page, but my CSS doesn't work fully. It only loads parts of it. Can somebody help me please? My layout: <?php namespace app\views\layouts; use yii\bootstrap\Alert; use yii\bootstrap\ActiveForm; use yii\helpers\Url; use yii\helpers\Html; use yii\bootstrap\NavBar; use yii\bootstrap\Button; use app\models\Search; use yii\bootstrap\Nav; use app\assets\AppAsset; use app\models\LoginForm; use yii\web\View; use Yii; AppAsset::register($this); ?> <

How to solve Swift_TransportException Connection to ssl Timed Out error?

*爱你&永不变心* 提交于 2019-12-12 01:41:47
问题 I have a problem send email using Yii, the problem is sometime it result in ssl timeout, but some time mail send is going well. The error says something like this Swift_TransportException Connection to ssl://in-v3.mailjet.com:465 Timed Out Here is the error image After reading some article, it's looks like because socket is timeout so it should start socket again. Here is my article that I read. swiftmailer and Yii2 not working 1 out of 10 time How to close Smtp connection in SwiftMailer Here

How to install Jquery UI in YII2?

删除回忆录丶 提交于 2019-12-12 01:39:02
问题 I work on YII project (advanced) and want to use JUI Extension for Yii 2 I've put "yiisoft/yii2-jui": "~2.0.0" line to my composer.json file and run composer install . After that I've tried to use widget: <?php use yii\jui\Sortable; /* @var $this yii\web\View */ /* @var $searchModel common\models\SearchSomeModel */ /* @var $dataProvider yii\data\ActiveDataProvider */ echo Sortable::widget([ 'items' => [ 'Item 1', ['content' => 'Item2'], [ 'content' => 'Item3', 'options' => ['tag' => 'li'], ],

How to show yii2 database relation in view

て烟熏妆下的殇ゞ 提交于 2019-12-12 01:37:20
问题 I am new in yii2. I don't know much about table relation. I have a 3 tables shops promotions and promotion_details. promotion_details contains promotion id and shop id. promotion has status like active or inactive. i want display in shop view only active promotions. How can i Do that? Thanks in advance 回答1: In you promotion_detail view add a getter function for relation and a getter function for the field /* ActiveRelation */ public function getPropomition() { return $this->hasOne(Promotion:

Calculate 3 fields and display the result in the 4th in yii2 dynamic form

喜你入骨 提交于 2019-12-12 01:26:12
问题 I'm trying to calculate sum of 3 fields - si_mrp + si_discp + si_taxpc in yii2 dynamic form. This is the same solution of Calculate from 3 inputfield in dynamic form yii2. But the present solution is not working. form fields <?= $form->field($modelsProductsales, "[{$i}]si_mrp")->label(false)->textInput(['maxlength' => true,'onchange' => 'getUdisc($(this))', 'onkeyup' => 'getUdisc($(this))','class' => 'mrp','placeholder' => 'MRP']) ?> <?= $form->field($modelsProductsales, "[{$i}]si_discp")-

Yii2: how to display images from backend/web to frontend in advanced app

放肆的年华 提交于 2019-12-12 01:22:46
问题 I need to display 1 (first) image which path is saved in database like Img1.jpg;img2.jpg; , I tried to seperate each path by using explode , getting all the images as array but not able to pick single path- <div class="col-sm-6 masonry-item"> <a href="<?php echo Url::to(['site/roompage']); ?>" class="product_item text-center"> <span class="product_photo bordered_wht_border"> <?php foreach (explode(';',rtrim($row['images'],';'),1) as $key_img => $value_img) { ?> <?php echo Html::img('@backend

Yii2 Custom / Shorter Namespace

旧巷老猫 提交于 2019-12-12 00:53:16
问题 I have a nested 'mail' module in my yii2 (basic template) at this location: @app/modules/admin/modules/mail How do I create shorter namespaces in all of the modules files. So instead of this namespace in my controller files: namespace app\modules\admin\modules\mail\controllers; I could just have: namespace mail/controllers; If I ever move the module folder, I wouldn't have to go and manually change the namespace in every single file (also they're just long). The docs actually recommend this