Jump to content

Clarity

Members
  • Posts

    84
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Clarity

  1. 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?
  2. 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.

  3. 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;
      }
    
    }
    
    • Thanks 1
  4. 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).

  5. 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!

  6. 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?

  7. 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?
  8. 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".

    • Like 1
  9. 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?

    • Like 1
  10. 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.

  11. 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.

  12. 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.

×
×
  • Create New...