# |
Feb 10th 2020, 03:01 |
challgren |
That's JavaScript related |
# |
Feb 10th 2020, 02:05 |
wizardfix |
Like, how to get a `select` element to submit when it's value changes? If I set `'type' => 'select'` I cannot also set `'type' => 'submit'` ... :thinking_face: |
# |
Feb 10th 2020, 02:01 |
wizardfix |
Yeah I've been reading but wish their were more form creation examples. |
# |
Feb 10th 2020, 02:00 |
challgren |
Np I’d read up on the form helper its pretty handy some of the stuff it can do. But it does take a bit of convincing to get it to do what you want |
# |
Feb 10th 2020, 01:59 |
wizardfix |
Wow, it works! Thank you a whole heap1 :beer: :beer: @challgren |
# |
Feb 10th 2020, 01:57 |
challgren |
do label=false in your options array |
# |
Feb 10th 2020, 01:56 |
wizardfix |
Now it sends the data - win - but displays the name above the selector, which I don't want! |
# |
Feb 10th 2020, 01:53 |
wizardfix |
Aha! |
# |
Feb 10th 2020, 01:53 |
challgren |
That first parameter is the name |
# |
Feb 10th 2020, 01:53 |
challgren |
Ohh ok, well your issue is your input doesn’t have a field name |
# |
Feb 10th 2020, 01:52 |
wizardfix |
I just want to get data from the request in my `filter()` method |
# |
Feb 10th 2020, 01:50 |
challgren |
remove the action part if your want it to go to self |
# |
Feb 10th 2020, 01:49 |
wizardfix |
I must be missing something here. Using (in 3.8) FormHelper to create a Form with a dropdown selector with 3 options. But when the form is submitted, the value of `$this->request->getData()` is `null`. I changed the HTTP method to `GET` , expecting the selected value to be included in the URL as a query string parameter, but the request just goes to `users/filter`. |
# |
Feb 9th 2020, 22:53 |
sdevore |
if you have routes that specify the _namePrefix (like for API calls) and routes that don’t it seems if i use Router::url() is there a way to get the one with out the the name. I seem to always get `/api/programs/view…' vs `/programs/view...` It is mostly a cosmetic issue, but I don’t want those in the url… |
# |
Feb 9th 2020, 20:01 |
phantomwatson |
In your controller, you can also call `$this->render(...)` with the path to the template file that you want to use. https://book.cakephp.org/3/en/controllers.html#rendering-a-view |
# |
Feb 9th 2020, 19:20 |
wizardfix |
I worked around it by creating `search.ctp` with `$this->extend('/Results/index');` in it. :) |
# |
Feb 9th 2020, 18:54 |
wizardfix |
v. 3.8: How do I override the default view template when rendering, so that my `search()` view function uses the `index.ctp` template instead of `search.ctp`? :thinking_face: |
# |
Feb 9th 2020, 12:03 |
damiano |
thanks |
# |
Feb 9th 2020, 12:03 |
damiano |
interesting @lpj145 |
# |
Feb 9th 2020, 11:42 |
slackebot |
<lpj145> |
# |
Feb 9th 2020, 11:42 |
slackebot |
<lpj145> |
# |
Feb 9th 2020, 11:42 |
slackebot |
<lpj145> |
# |
Feb 9th 2020, 11:41 |
lpj145 |
is a best approachable instead of use extensions. |
# |
Feb 9th 2020, 11:41 |
lpj145 |
@damiano why not use direct response ? instead of needed of view ? |
# |
Feb 9th 2020, 11:35 |
damiano |
thanks @challgren! |
# |
Feb 9th 2020, 11:35 |
damiano |
and now it works correctly |
# |
Feb 9th 2020, 11:34 |
damiano |
i removed :?Response |
# |
Feb 9th 2020, 11:34 |
damiano |
done! my wrong...grr, sorry, i has pagamento() :?Response { .... } |
# |
Feb 9th 2020, 11:34 |
damiano |
waiit |
# |
Feb 9th 2020, 11:34 |
damiano |
return $this->response; |
# |
Feb 9th 2020, 11:33 |
damiano |
i also have tried with |
# |
Feb 9th 2020, 11:33 |
slackebot |
$this->set('my_response',$my_results); $this->viewBuilder()->setOption('serialize', 'my_response'); } |
# |
Feb 9th 2020, 11:33 |
damiano |
public function pagamento(): ?Response { Stripe::setApiKey(''); //debug($this->request->getData()); $my_results = ['foo'=>'bar']; $this->set('my_response',$my_results); $this->viewBuilder()->setOption('serialize', 'my_response'); //return $this->render(); return $this->response; }public function pagamento(): ?Response { $my_results = ['foo'=>'bar']; |
# |
Feb 9th 2020, 11:33 |
damiano |
now i show my action one moment |
# |
Feb 9th 2020, 11:33 |
damiano |
but i see no output |
# |
Feb 9th 2020, 11:33 |
damiano |
yeah i fixed the name problem |
# |
Feb 9th 2020, 11:32 |
challgren |
See https://gist.github.com/challgren/4aff946047b7a203805d8030cce73530 |
# |
Feb 9th 2020, 11:30 |
damiano |
no works @challgren |
# |
Feb 9th 2020, 11:30 |
challgren |
This |
# |
Feb 9th 2020, 11:29 |
damiano |
Notice Error: Undefined variable: routes |
# |
Feb 9th 2020, 11:29 |
challgren |
your anonymouse callback with RouteBuilder is named something different than the books docs |