Jump to content

'Fields' error


jeng
 Share

Recommended Posts

I've gotten an error when creating a field:

"Unknown Selector operator: '' -- was your selector value properly escaped?"

Not a big deal, I know what went wrong, but now I can't actually edit the field any more. Every time I click on the field in the table of fields, the error shows up with no way of actually correcting it. 

Anyone experience this before and have a work around? I'm not even sure how I could just delete the field and create a new one, as a template that has the field also shows the error.

Link to comment
Share on other sites

I am not sure about that error in the context of field creation - perhaps you can share what went wrong.

Generally not good practice as it can get you in trouble if you don't know what you are doing, but you may need to fire up PHPMyAdmin and delete the "field_fieldname" table and also the relevant row from the "fields" table.

Link to comment
Share on other sites

  • 7 months later...

I've encountered something similar with a page field: can't access it anymore, i'm getting the following error message:

Recoverable Fatal Error: Argument 1 passed to InputfieldPage::___findPagesCode() must be an instance of Page, none given (…)

I wish i could simply correct the field or at least delete it, but i can't access it at all. 

I'm a bit reluctant to get into phpmyadmin to delete it, but I don't really want to leave a trouble field in the field list. Any way to delete a field with php?

Link to comment
Share on other sites

Depending on just how corrupted things are, this should remove the field from all templates and then delete the field:

$field_name = "myfieldname";

foreach($templates as $template){
    foreach($template->fieldgroup as $field){
        if($field->name == $field_name){
            $template->fieldgroup->remove($field);
            $template->fieldgroup->save();
            break 2;
        }
    }
}

$fields->delete($field);

The first chunk of code is stolen from Soma. I just added the bit at the end to delete the actual field as well.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...