This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

pain-spark50564
pain-spark50564

Hi everybody! I want updated a partial via component/ajax, but nothing goes right, i have changed data-request and data-request-update many times, but nothing have sucess, this is one of my results.

" The partial '::calcresult' is not found. "

This is code from the page...

title = "formteste"
url = "/formteste"
layout = "default"
is_hidden = 0
==
<form data-request="onRender" data-request-update="'@calcresult': '#magica'">

    <!-- Input two values -->
    <input name="value1" type="text" > <br>

    <input name="value2" type="text"> <br>

    <input name="value3" type="tel"> &nbsp; &nbsp;

    <!-- Action button -->
    <button type="submit">Mandar</button>

</form>

<!-- Result container -->
<div id="magica">   </div>

NEXT > my component code

<?php namespace October\Demo\Components;

use Cms\Classes\ComponentBase;
use ApplicationException;

class Todo extends ComponentBase
{

    public function componentDetails()
    {
        return [
            'name'        => 'Lista todo',
            'description' => 'Faz uma lista todo.'
        ];
    }

    public function defineProperties()
    {
        return [
            'max' => [
                'description'       => 'Quantidade de itens permitidos.',
                'title'             => 'itens maximo',
                'default'           => 100,
                'type'              => 'string',
                'validationPattern' => '^[0-9]+$',
                'validationMessage' => 'O valor maximo de itens tem que ser um numero inteiro.'
            ]
        ];
    }

    public function onRender()
    {
        $this->page['result'] = input('value1');
        $this->page['nome']   = input('value2');
        $this->page['tel']    = input('value3');

    }

}

and FINALLY > my partial code

Resultado ?:  {{ result }} {{nome}} {{tel}}

Someone can help me please ?

Last updated

pain-spark50564
pain-spark50564
''
title = "formteste"
url = "/formteste"
layout = "default"
is_hidden = 0
==
<form data-request="onRun" data-request-update="calcresult : '#myDiv'">

    <!-- Input two values -->
    <input name="value1" type="text" > <br>

    <input name="value2" type="text"> <br>

    <input name="value3" type="tel"> &nbsp; &nbsp;

    <!-- Action button -->
    <button type="submit">Mandar</button>

</form>

<!-- Result container -->
<div id="myDiv">   </div> ''

Last updated

pain-spark50564

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.