octobercms

October CMS - Ajax URL?

允我心安 提交于 2019-12-12 05:08:27
问题 I want to use Angular JS for October CMS. But how to i POST data to the controllers? I found this in the October framework.js file headers: { 'X-OCTOBER-REQUEST-HANDLER': handler, 'X-OCTOBER-REQUEST-PARTIALS': this.extractPartials(options.update) }, But i have a hard time debugging it. What is the URL this posts to? And how would i use this.extractPartials(options.update) 回答1: If you want to post a simple data to the controller and want to update the view file, then you better go with october

OctoberCMS. Variable disappears after ajax request

一曲冷凌霜 提交于 2019-12-12 04:59:46
问题 My component template code: default.htm: <div id="filter_variations" style="//display: none;"> {{ form_ajax('onAjaxVariations') }} <input type="text" id="var_id" name="Filter[id]" value=""> <input type="submit"> {{ form_close() }} </div> <div id="partial_service"> {% partial __SELF__ ~ '::service' %} </div> in partial i try display "service" variable, and dynamic "variations" variable: <h1>{{service.name}}</h1> <span>Selected variation: variation[0].name</span> and it works Component: but if

October CMS Routing

社会主义新天地 提交于 2019-12-12 04:46:34
问题 I'm trying to configure routes in my OctoberCMS app. I configure routes in Plugin.php file of my plugin. At the moment my code: public function boot() { Validator::extend('numeric_for_repeater', function($attribute, $value, $parameters) { foreach ($value as $v) { $validator = Validator::make( $v, [ 'stock_quantity' => 'sometimes|numeric', 'stock_votes_quantity' => 'sometimes|numeric', 'value' => 'sometimes|numeric', ], $parameters ); if ($validator->fails()) return false; } return true; });

octoberCMS | share the code between layouts

北战南征 提交于 2019-12-12 03:45:47
问题 On my default layout I have many AJAX handlers , but for my project, I need to create static pages with the same layout but with different variables (fields for client)... So as I understand I need to create different layout's that extends the partials from default layout ... But there are some way to share the code between the layouts to prevent repeating? Or, there are some way to create different variables on a layout to diferrent statics pages? Ex. of var. code: {variable name="tagline"

Octobercms set dynamically datepicker minDate

六月ゝ 毕业季﹏ 提交于 2019-12-11 21:17:42
问题 I need to set dynamically public function filterFields($fields, $context = null) { $return_date = $fields->return_date->value; if(empty($return_date)) { $fields->return_date->minDate = Carbon::now(); } } Not work! 回答1: Hmm, may be datetime widget is setting this restrictions at init time and filterfields is fired after that so it can not use new modified data . to over come this we set config data before init , we use controller method formExtendFieldsBefore add this method to your controller

Set value for amountToRelad var so it can be accessed on any method on the class

廉价感情. 提交于 2019-12-11 20:43:06
问题 I'm working in a OctoberCMS component and have some problems getting things working. Take a look at this code: class Payment extends ComponentBase { /** * This hold the amount with PayPal fee and discount applied and pass back to template * @var float */ public $amountToReload; public function onAmountChange() { $amount = post('amount'); if (empty($amount)) { throw new \Exception(sprintf('Por favor introduzca un valor.')); } $this->amountToReload = round($amount - ($amount * (float) Settings:

Hide content of blog posts when displaying blog post list in OctoberCMS?

喜夏-厌秋 提交于 2019-12-11 19:23:48
问题 I want to show a list of blog posts, and just display the Title and publish date of the blog posts. However, at the moment, it also displays the content of the blog posts as well. How can I remove the blog content from being displayed on a blog post list? I don't want to rely on CSS, I'd like to remove it properly from the markup. 回答1: I managed to figure it out. Deep within the bowels of the plugin, there's a file called default.htm . It's located here: plugins/rainlab/blog/components/posts

How to return the key value from a checkbox list field which automatically updates another field

╄→尐↘猪︶ㄣ 提交于 2019-12-11 17:58:37
问题 I would like it so that when one or more of the options in my checkboxlist has been ticked, the value of said option will then update the amount field. I'm sort of cheating as I'm using the key value to be the price of the field which I would then like to update the amount field with. This already works perfectly with the dropdown fields and this does calculate the amount field depending on what has been selected. As I've had to make the checkboxlist jasonable, the way in which this returns

OctoberCMS: how to set repeater widget autoload

可紊 提交于 2019-12-11 16:17:24
问题 can i set the repeater widget to auto load when the form open? it has max item property, can it auto load to max item number so user dont need to hit the prompt button re-updated this my fields.yaml fields: nowarta: label: 'No. Warta' oc.commentPosition: '' span: auto placeholder: 'format penulisan ''No. 34 Tahun XIX''' type: text tanggal: label: Tanggal oc.commentPosition: '' mode: date format: 'd - F - Y' span: right type: datepicker ignoreTimezone: false renungan: label: 'Renungan Mingguan

How to flash a message in front-end?

北城余情 提交于 2019-12-11 16:07:52
问题 How can I flash a message like on this page: https://octobercms.com/docs/ui/flashmessage What should I include and where? Exactly I need flash a message after an user submitted some form. On Octobercms forum I find kind of difficult ways to do it. 回答1: Include this attribute data-request-flash in your form tag like below <form data-request-flash > and add below code on same page/file where your form is {% flash %} <p data-control="flash-message" class="flash-message fade {{ type }}" data