-
Posts
84 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Clarity
-
-
Hello everyone!
I have a HTML code for the form:
<form class="contact-form" action="/ajax-handler/" method="POST"> <input type="text" placeholder="Name"> <input type="text" placeholder="Phone"> <input type="text" placeholder="Message"> <button type="submit">Submit</button> </form>
I have an JS code which handles it via AJAX request:$(function() { var form = $('.contact-form'); $(form).submit(function(e) { e.preventDefault(); var formData = $(form).serialize(); $.ajax({ type: 'POST', url: $(form).attr('action'), data: formData }) .done(function(response) { alert(1); }) }); });
However, when I open "Network" tab in Dev Tools, I see that the request goes to the same page where the form is being placed, not to /ajax-handler/ page. Can you please tell me where I was wrong? -
Thank you, it indeed works.
-
Hello everyone!
Can you please tell me how to convert Pageimages collection to plain array?
-
14 hours ago, Pixrael said:
class Test extends \Wireframe\Controller {
public $var;
...... etc
}maybe?
Yes, it works too. Thank you for the advice.
14 hours ago, flydev 👊🏻 said:Then reason is the following:
...
Hope you get it. And guys correct me if I am wrong, thanks.
Let me think about it. Thank you about the explanation. 🙂
10 hours ago, gRegor said:Not ProcessWire-specific. $this-> is the way to access properties and methods within the object, as part of Object Oriented Programming. More: https://www.php.net/manual/en/language.oop5.properties.php
Thank you for the addition.
-
Well, my code is like this:
<?php namespace Wireframe\Controller; class Test extends \Wireframe\Controller { public function init() { $var = $this->foo(); $this->var = $this->foo(); $this->view->var = $this->foo(); bd($var); // 1 bd($this->var); // null bd($this->view->var); // 1 } public function foo() { return 1; } }
-
1
-
-
Hello, @AndZyk!
Yes, I think it might be the reason. Using $this->view in Wireframe instead of $this resolved my problem.
-
1
-
-
Thank you, I already found that I can use additional single-valued Page Reference for my purposes.
-
Sorry if I was unclear, but it's not quite what I want. I need all pages with this Page Reference and with given in the selector value of the first element of this Page Reference, not the first page with this Page Reference.
-
Thank you, but can I actually use it in the selector string? I need to find the pages with specific Page Reference and access the first element of them, not simply get the first page of the collection.
-
Hello everyone!
Can you please say how is this situation really possible?
1) On some line of the code inside a class, I assign the value: $this->var = $this->foo().
2) On the next line of this code, I compare these two and output to TracyDebugger: bd($this->var == $this->foo());, but it outputs false value (first is null and $this->foo() is a set of pages).
-
Hello everyone!
I need to access first element of Page Reference (and generally first element of any collection) field using a selector. Something like $pages->find('page_reference.first=value'). I can't find how to do it in the documentation. Can you please advice me how to do it?
-
The reason why I was trying to resize SVG is that I need to make repeated set of images sizes of which are independent of sizes which user loads into the field.
Anyways, adding width and height attributes resolved my problem. Thank you for the advice!
-
Hello everyone!
I'm trying to resize SVG image using size() function. However, the image appears to be unchanged. I'm using FileValidatorSvgSanitizer module for sanitization of SVGs. What should I do for resizing SVG image if I want to resize them programmatically?
-
Thanks for the advice, but it doesn't work for me. The error remains the same. My settings/settings.php is like that:
<?php$inputfields = array(array("name" => "emails","label" => "Emails","type" => "InputfieldMultiplier","fieldtypeClass" => "FieldtypeText","schemaClass" => "FieldtypeText","qtyMin" => 3,"qtyMax" => 6,"width" => "100","description" => "","collapsed" => 0,"placeholder" => "","columnWidth" => 50),array("name" => "phones","label" => "Phones","type" => "InputfieldMultiplier","fieldtypeClass" => "FieldtypeText","schemaClass" => "FieldtypeText","qtyMin" => 3,"qtyMax" => 6,"width" => "100","description" => "","collapsed" => 0,"placeholder" => "","columnWidth" => 50));return $inputfields;Can you please say what I'm doing wrong? -
Thank you about the information! Can you please tell whether it is possible to use ProField: Multiplier for this module? I'm getting an error "ProcessSettingsFactory: Fieldtype is not set".
-
1
-
-
Hello, @Macrura!
Haven't you added the possibility to handle repeaters with this module with updates? I've read at the beginning that it was impossible, but something might change with time.
-
Hello, @Mats!
There is a problem with usage of this field when it is being added inside Repeater. The map does not load when I click to Repeater item since Leaflet's JavaScript is not being initialized after AJAX request. Can you please fix it?
-
1
-
-
Hello everyone!
I have an error "Uncaught ReferenceError: jsMarkupLeafletMap is not defined". My version of ProcessWire is 3.0.199 dev and the version of the module is the latest dev. I found that previously @Marco Angeli resolved the problem here, but it doesn't seem to be my case.
Edit: I forgot to add <?php echo $map->getLeafletMapHeaderLines(); ?> to the head. That was my mistake.
-
Thank you, @Ivan Gretsky! It is right.
-
Hello everyone!
I'm using htmx to send a form to /scan URL, but no "search" parameter is present in "get" in $input variable:
<form hx-get="/scan" hx-trigger="submit" hx-target="#result" hx-swap="outerHTML" id="scan-form"><input type="text" name="search"><input type="submit"></form>Can you please tell me where is my mistake? -
I found a solution: instead of Wireframe::partial call $this->view->partials->get.
-
3
-
-
Hello!
I need to call Wireframe partial from component's controller method. How can I do it? I see __callStatic method in Wireframe.module.php which seems that may help, but don't know how to apply it.
-
I got it, thank you! I've thought that it is not a good practice because the title may contain letters on other languages which might cause problems with encoding.
-
On 5/20/2022 at 10:38 PM, kongondo said:
Hello @Clarity,
The menu name is automatically created from the menu title. It is not separately editable via Menu Builder (it's a page though). Could you please explain why you need access to the name?
The problem is that I need to use the title, say, 'footer-menu' in code: $menuBuilder->getMenuItems('footer-menu'). Then I think it is not a good practice to give a title to menu like 'Footer Menu'. Also, if the title can be multi-language, it might, I think, cause other issues.
How to get a limit in selector for PageReference via API?
in API & Templates
Posted
Hello everyone!
I have a PageReference field and I need to get a selector of resulting PageArray for the purpose of setting the limit of these pages in order to use it in the pagination. Can you please give me an advice?