Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher Release Candidate 11
#31

[eluser]cre8tive[/eluser]
Also, if you can explain the relationships a little in the yml form.

I created a yml form with 3 dbdropdowns, but when it goes back to the table view, it is erroring out.
I am assuming I need to create the 3 relationships in the yml file also.

This is the error I receive after I add a new record and it goes back to the table view for that area:

A PHP Error was encountered
Severity: Notice

Message: Undefined index: general_information

Filename: view_modes/table.php

Line Number: 183

My yml file is:
Code:
rules:
  name: required
  leadtype:  required
  territory:  required
  ordertype:  required
form_setup:
  general_information:
    class: FieldSet
    params:
      form:
        name:
          class: TextBox
        leadtype:
          class: DbDropDown
          label: Lead Type
          params:
            field:name
            table:lead_type
            primary_key:id
        territory:
          class: DbDropDown
          label: Select Territory
          params:
            field:shortname
            table:territories
            primary_key:id
        ordertype:
          class: DbDropDown
          label: Select Order Type
          params:
            field:name
            table:order_type
            primary_key:id
#32

[eluser]Majd Taby[/eluser]
could you edit your last post and wrap the code in [CODE] tags? I can't help you much if I can't see the structure of your file...
#33

[eluser]tylderdurden[/eluser]
[quote author="jTaby" date="1207208772"]tylderdurden, well, before, during, and after a record is edited, an event is triggered. If you would like to do something special, then write your own event. I suggest you check out the Khaos :: Event Manage thread for more information.

I don't understand what you mean by the last line, could you expand?[/quote]

With the time class, you can use onupdate or oninsert to trigger a value to insert into the db. Just doing through the code of date, it doesn't seem like anything like that exists.

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: form_setup

Filename: plugins/manytomany.php

Line Number: 102

I'm getting this error when clicking "Add New" to a manytomany field. The tables are set up

articles -> article_id, article_content
categories -> category_id, category_name
articles_categories -> id, categories_id, articles_id

Code:
categories:
    class: ManyToMany
    params:
        display_field: category_name
        primary_key: category_id

Ideally, I'd like to use article_id and category_id in the relationship table, but it doesn't seem to work that way?
#34

[eluser]Majd Taby[/eluser]
cre8tive, This YAML code works for me just fine:

Code:
general_information2:
    class: FieldSet
    params:
        form:
            sessiondata_test:
                class: SessionData
                params:
                    item: user_name
            textarea_test:
                class: TextArea
                attributes:
                    rows:5
                    cols:50
            time_test:
                class: Time
                params:
                    -on_update
            dbdropdown_test:
                class: DbDropDown
                params:
                    field:name
                    table:related_example
                    primary_key:id
            dbdropdown3_test:
                class: DbDropDown
                params:
                    field:name
                    table:related_example2
                    primary_key:id
            dbdropdown2_test:
                class: DbDropDown
                params:
                    field:name
                    table:related_example3
                    primary_key:id
#35

[eluser]Majd Taby[/eluser]
@tylderdurden, Line 201 of manytomany.php is: $config = $this->config['form_setup'];

That line gets executed only if you have a yaml file whose name corresponds to categories.yml
If the plugin finds that file, it assumes that you define your custom form there, and attempts to load it. Could you paste the contents of categories.yml here? (in [CODE] tags)
#36

[eluser]tylderdurden[/eluser]
Code:
general_information:
    class: FieldSet
    params:
        form:
            category_name:
                class: TextBox
            category_id:
                class: TextBox

Also, if I have the follow yml file

Code:
general_information:
    class: FieldSet
    params:
        form:
            category_name:
                class: TextBox

and the following categories.php controller

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

include("codexcontroller.php");

class Categories extends codexController
{
    function Categories ()
    {
        codexController::codexController();

        $this->load->library('spyc');                

        $this->load->helper('inflector');

        $rules['category_name'] = "trim|required";
        $config = array(
                    'db_table' => 'categories', //The name of the table associated with this controller
                    'form_setup' => $this->spyc->YAMLLOAD('definitions/categories.yml'), //The array that holds our elements
                    'controller_name' => 'Categories', //The name of the controller, so that it can be used when generating the URLs
                    'primary_key' => 'category_id', //The name of the controller, so that it can be used when generating the URLs
                    'display_fields'=>array('category_name')
                    );
        $this->setConfig($config);
    }
}
?>

The list will show click to edit instead of the category name.
#37

[eluser]Majd Taby[/eluser]
Change to:
Code:
form_setup:
    general_information:
        class: FieldSet
        params:
            form:
                category_name:
                    class: TextBox
                category_id:
                    class: TextBox
#38

[eluser]tylderdurden[/eluser]
[quote author="jTaby" date="1207210941"]Change to:
Code:
form_setup:
    general_information:
        class: FieldSet
        params:
            form:
                category_name:
                    class: TextBox
                category_id:
                    class: TextBox
[/quote]

If I do that, it breaks my categories page.
#39

[eluser]Majd Taby[/eluser]
Does it give you a "A PHP Error was encountered

Severity: Notice

Message: Undefined index: general_information

Filename: view_modes/table.php

Line Number: 183"

Error?
#40

[eluser]tylderdurden[/eluser]
[quote author="jTaby" date="1207211336"]Does it give you a "A PHP Error was encountered

Severity: Notice

Message: Undefined index: general_information

Filename: view_modes/table.php

Line Number: 183"

Error?[/quote]

using the yml file you provided and the controller I have above, it generates this error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined index: class

Filename: libraries/codexforms.php

Line Number: 53

I should also mention that the javascript doesn't work quite right (on the manytomany on the articles page) - if you click add after filling out the forms, it just adds another form to the page.




Theme © iAndrew 2016 - Forum software by © MyBB