Giter Club home page Giter Club logo

forms's People

Contributors

amranidev avatar arturmamedov avatar casperboone avatar elanclarkson avatar graemekilkenny avatar jimhlad avatar mlantz avatar sagarrabadiya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

forms's Issues

access selected fields only

FormMaker::fromTable('users') shows user all field that's ok .
But i want show only selected fields .
I knew @input_maker method for custom form but it is time consuming

Thanks...

fromObject() not populating data correctly

Hi,
Im passing details from database as object, all of the form fields fills up correctly except the drop downs, they just get populated with possible options but value from database isnt getting selected.
This is my code,

{!! FormMaker::fromObject($patient,
            $columns = $inputs,
            $view = 'user._input',
            $class = '',
            $populated = true,
            $reformatted = false,
            $idAndTimestamps = false) !!}

$inputs is array of inputs being passed from the trait to controller to this view.
below is how i have setup the select dropdown in input trait.

'bloodgroup' =>[
              'type' => 'select',
              'class' => 'col-xs-10 col-sm-5',
              'alt_name' => 'Blood Group',
              'options' => [
                  'unknown' => 'unknown',
                  'A+' => 'A+',
                  'B+' => 'B+',
                  'O+' => 'O+',
                  'AB+' => 'AB+',
                  'A-' => 'A-',
                  'B-' => 'B-',
                  'O-' => 'O-',
                  'AB-' => 'AB-',
              ]

I should have messed up somewhere, please point me in right direction.

Thanks

error with @input_maker_create

Im working with laracogs.
here is the error im getting:
snippet im using::
@input_maker_create('meta[phone]', ['type' => 'string'], $user)
result im getting::
<input id="Meta[phone]" class="form-control" name="meta[phone]" value="{" id":1,"user_id":1,"phone":null,"is_active":1,"activation_token":"59afc4ace32e7a6b8b3d8e69d1659f05","marketing":0,"terms_and_cond":1,"created_at":"2017-01-19="" 11:47:44","updated_at":"2017-01-19="" 11:47:44"}"="" placeholder="Meta Phone" type="text">

As you can see, I want the value from phone field from meta table to populate the table, instead chaotic is going on in here!!

checkbox type input, not add the custom class that i set

I have this config:

'in_promotion' => [
    'type' => 'checkbox',
    'class' => 'flat-green',
],

And the generated input haven't the flat-green class that i set

<div class="form-group ">
        <label class="control-label" for="In_promotion">In_promotion</label>
        <input id="In_promotion" name="in_promotion" type="checkbox">
</div>

Feature Request - Allow users to change connection when using multiple connections

Currently in FormMaker, the behavior gets the information of a table and creates a form based on the information gathered.

For my project, I have multiple data sources to pull from so I have multiple connections that I want to be able to create cruds for. That being the case, I need to be able to specify the connection.

    public function fromTable(
        $table,
        $columns = null,
        $class = 'form-control',
        $view = null,
        $reformatted = true,
        $populated = false,
        $idAndTimestamps = false,
        $connection = null
    ) 

This would probably be an ideal signature to avoid breaking earlier versions.

The following line will work exactly the same with this new signature, but will use a different schema if connection is defined.

$tableColumns = Schema::connection($connection)->getColumnListing($table);

Multi select pre-fill existing values on edit screen error: Call to undefined method Illuminate\Database\Query\Builder::roles()

I am using the standard User - Roles relationship tables as set up by default in Quarx.

When I try to use formMaker to show existing roles on the user edit screen I get the following error:

[2018-04-16 16:14:24] local.ERROR: Call to undefined method Illuminate\Database\Query\Builder::roles() (View: C:\wamp\www\proj\resources\views\admin\users\edit.blade.php)

Here is my edit blade file:

 {!! FormMaker::fromObject($user,
           [
           'name',
           'meta[first_name]' => [
                'alt_name' => 'First Name',
            ],
           'meta[roles]' => [
                'alt_name' => 'Roles',
                'custom' => 'multiple',
                'multiple' => true,
                'class' => auth()->user(),
                'method' => 'roles',
                'type' => 'relationship',
                'model' => 'App\Models\Role',
                'label' => 'label', // the field for the label in the select input generated
                'value' => 'name' // the field for the label in the select input generated
            ],
          ] ) !!}

        {!! Form::submit('Update', ['class' => 'btn btn-primary pull-right']) !!}

 {!! Form::close() !!}

If I remove the method and class attributes then it shows the multi select but all of the options are selected by default:

'meta[roles]' => [
                'alt_name' => 'Roles',
                'custom' => 'multiple',
                'multiple' => true,
                'type' => 'relationship',
                'model' => 'App\Models\Role',
                'label' => 'label', // the field for the label in the select input generated
                'value' => 'name' // the field for the label in the select input generated
            ]

2018-04-16_16h27_42

Not sure what's going on here, I am using "yab/laracogs": "^2.3",

v1.0.8 of FormMaker is broken

v1.0.8 of FormMaker has a syntax error on line 70, where $connection is misspelled when passed in as an argument. It's fixed in origin/master, but when composer requires FormMaker as a dependency for laracogs, it asks for the broken version. I can't submit a pull requests for tag changes, so it'll have to be fixed by YABhq, something like this:

image

@form__object_maker does not set default values

I have the following in a blade template....

@form_maker_object(
                    $package_item->package_meta_data,
                    Cms::moduleConfig('package_items', 'form')
                    )

the package_meta_data attribute is a ValueObject class object with an attributes property which is accessed via magic methods. i.e. __get() __set()

the Cms::moduleConfig('package_items', 'form') consists of an associate array having the attributes of the said ValueObject class and input configurations.

e.g.

'form' => [
      'package_name' => [],
      'package_description' => [
        'type' => 'text'
      ],
      'package_price' => [
        'type' => 'number'
      ],
      'package_vendor' => [],
      'package_notes' => [
        'type' => 'text'
      ],
      'package_ref_id' => [
        'type' => 'hidden'
      ],
      'meta_package_length' => [
        'type' => 'number',
        'alt_name' => 'Package Length'
      ],

however when rending the form fields in edit mode the fields are blank.

What is the case here if the object has property values?

input_maker_create fails on empty table

I have the following inside a blade file:

@input_maker('category', [ 'type' => 'relationship', 'model' => 'App\Models\Category', 'label' => 'name', 'value' => 'id'

That throws an error saying that options are required. To reproduce the error, the categories table must be empty, when I add at least one row to the table the error stop appearing.

Zip/Postal

use ziptastic to set city and country?

There should be an attribute to define input ID

There should be an attribute to define individual input IDs, at least for checkbox and radio inputs. I found this problem trying to define two radio buttons with the same name, so the user could choose one or another option. The problem is that they consecuently inherit the name as ID, and that's not right.

public function makeRadio($config, $selected, $custom)
{
     return '<input ' . $custom . ' id="' . ucfirst($config['name']) . '" ' . $selected . ' type="radio" name="' . $config['name'] . '">';
}

yab/formmaker/src/Generators/HtmlGenerator.php

@input_maker_label: cannot create label with different name to linked input id

Steps to reproduce
Try create a label such as <label for="job_number">Job Number</label> with input_maker_label

Expected
A way to create a label with a different name to the input ID that is linked with for attribute

For example
input_maker_label('input_id', ['label' => 'Label Name'])
or input_maker_label('Label Name', ['for' => 'input_id'])
outputting
<label for="input_id">label name</label>

Actual
With InputMaker->label you are forced to make the name the same as the for=".." attribute, which cannot be overridden.
<label for="input_id">input_id</label>

Or am I missing something? I see no alternative in the source code or documentation.
Thanks.

Timestamps that are auto converted to Carbon, get error

In my Model i add the proprety $dates for convert automatically the my timestamps to Carbon object and after this i get a error.

protected $dates = ['created_at', 'updated_at', 'deleted_at', 'from_ts', 'to_ts'];

What i'm get:
ErrorException in InputCalibrator.php line 56: Object of class Carbon\Carbon could not be converted to int (View: D:\serverpath\dev2016\yabhq-laracogs\www\laracogs\resources\views\pricelist\periods\edit.blade.php)

Capture

<button id="capture">Capture</button>
<canvas id="canvas" width="320" height="240"></canvas>
<script>
  const player = document.getElementById('player');
  const canvas = document.getElementById('canvas');
  const context = canvas.getContext('2d');
  const captureButton = document.getElementById('capture');

  const constraints = {
    video: true,
  };

  captureButton.addEventListener('click', () => {
    // Draw the video frame to the canvas.
    context.drawImage(player, 0, 0, canvas.width, canvas.height);
  });

  // Attach the video stream to the video element and autoplay.
  navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
    player.srcObject = stream;
  });
</script>```

JS Pattern conversions

Migrate each of these fields to the newer pattern for next version change

  • table
  • slug
  • passwordwithreveal
  • rating
  • quill
  • toggled
  • typeahead
  • filewithpreview
  • filepond
  • editor
  • dropzone
  • datepicker
  • customfile
  • code
  • autosuggestselect
  • autosuggest
  • attachments
  • bootstrap/select
  • bootstrap/toggle
  • bootstrap/datetimepicker

How to select old() input value after postback using @input_maker_create?

Given this:

@input_maker_create('product', ['type' => 'select', 'options' => $productDropDownListItems])

Where $productDropDownListItems outputs an array of options

[
1 => 'Load',
5 => 'Labels'
]

If the user selects labels... how do tell the input_maker_create to make value=5 as the selected value? I haven't found any examples or any docs referencing this specifically.

Thanks in advance!

#Question - There is a method for create form from table and get an object of fields

There is a method for create form from table and get an object or array of fields, copy it and after edit for my needs with more options that it allow.

In this way i first generate an object/array from table
After i copy this array/object and edit it for my fits
In the end i have an array genarated and edited from what i generate the final form.

Thank in advance! Cheer

Checkbox Value

Hello,

I might be missing something obvious here but i can't seem to get a 'value' for a checkbox using InputMaker

eg.

{{ Form::checkbox('published', true) }}

will give me

<input name="published" type="checkbox" value="1">

while

@input_maker_create('published', ['type' => 'checkbox'], $foo)

outputs

<input id="Published" type="checkbox" name="published">

Using a custom theme

Hi there guys,

I bought a bootstrap theme and have been using it with Laracogs. I recently came across the select element and can't seem to generate a select element that uses the theme within blade.

This is because when I use @foreach directive I can't seem to be able to create a roles selection. I can only achieve it using the default installation and normal bootstrap.

Regards

SoftDelete support for modal

Currently if the model has soft delete enabled, then the form renders deleted_at field also as date input

desired behaviour if the model has soft delete enabled then, deleted_at column should be counted as bad_column and should not include it in form.

Limiter on input maker models

Currently Laracogs eager loads the model of whatever relationship it's presented with. i.e.

@input_maker_label('Store')
@input_maker_create('stores', ['type' => 'relationship', 'model' => 'App\Repositories\Store\Store', 'label' => 'name', 'value' => 'id'], $user)

I'm looking for a way to limit what's loaded into the model somehow. Any ideas on how to go about this?

old() value failing on nested array

Old values are not been retained on nested arrays / forms

I could be wrong but this seems to be due to the fact that the method refineConfigs() seems to be checking for 'name' but the nested array will be array['name']

$inputConfig['inputs'][$name]

This can be recreated by running a fresh laravel install and laracogs starter.
On /user/settings add a phone number and delete the name or email and save.
The phone number will be lost.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.