zofe / rapyd-laravel

deprecated rewritten in rapyd-livewire
MIT License
866 stars 298 forks source link

Tag or Autocomplete remote not working and not show any error #195

Open Maykonn opened 9 years ago

Maykonn commented 9 years ago

I'm trying to create a tag input using remote method. But not working and don't show any error on console or request on network tab:

$form->add('parent_id', 'Parent', 'tags')->remote(null, "id", "/categories/json");

Head: app.blade.php

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Laravel</title>

    <link href="{{ asset('/css/app.css') }}" rel="stylesheet">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

    <!-- Fonts -->
    <link href='//fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>

    <!-- Scripts -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
zofe commented 9 years ago
Maykonn commented 9 years ago

No xhr requests and no error on console.

zofe commented 9 years ago

note that when you use remote on tags on a "non-related field" you should probably provide more params, try using:

$form->add('parent_id', 'Parent', 'tags')->remote("id","id", "/categories/json");

note also that to use "relations" you must use dot notation: "relation.relatedfieldname" instead of fkey

Maykonn commented 9 years ago

Continues the same behavior. I try remote method with relation, without a route, and not working too. No xhr and no errors. I tested jquery with $(document).ready(function() {alert('test');}); and alert test. I thought it might be something with jquery.