2

I've created a custom field for my plugin and it's working great, but if I want to use the same field within my templateDetails.xml I get an almost blank page in the template style edit page. I should probably mention that my getInput() method loads no layout, it simply returns an <input> with a bunch of attributes.

Here's my templateDetails.xml part

<fieldset name="advanced" label="Some FIELDSET NAME" 
    addfieldpath="/plugins/editors-xtd/myPlugin/models/fields">

    <field 
        name="myFieldName"
        type="myFieldType"
        label="SOME LABEL"
        hint="Some hint"
        description=""
        class=""
        format="HTML"
        default=""
    />
</fieldset>

The console says:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The page title says:

Error: 0 Call to undefined function random()

Is there something wrong here or am I missing something with my field?

  • just to eliminate possible issues - are you sure this error appears when you include your custom field in your templateDetails.xml? Can you remove it from your xml and see what happens? – FFrewin May 13 at 18:42
  • Yes, just did, I removed it and problem goes away, but I need the field there. I found that another field works, except that it doesn't load it's scripts, an easy fix. Going to investigate tomorrow as soon as I open my eyes. – thednp May 13 at 19:38
  • Whenever you're getting a Joomla error page, enable system debug in Global Configuration to see where it's coming from. – Sharky May 14 at 5:10
  • @Sharky I'm using full debug enabled, perhaps I need to enable show_error in php.ini once I get to that. – thednp May 14 at 8:07
0

Found the problem, I want to always use an ID for my fields to make sure they are unique for JavaScript initialization, so I misspelled rand() for random(), so while all my custom field instances were using an ID in the templateDetails.xml file, I couldn't figure out what's going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.