Joomla JForm no data (Joomla 2.5.8)

311 views
Skip to first unread message

Liam

unread,
Jan 6, 2013, 6:56:25 PM1/6/13
to joomla-de...@googlegroups.com
Hi there

I have been working on this for an hour and have now given up, I copied the code from my other working component but on my new one it says no data.

The form is a frontend form the model class extends JModelForm, I have 2 functions (the same 2 that is working in my other component) as follows:
    public function getForm($data = array(), $loadData = true)
    {
        JForm::addFieldPath(JPATH_COMPONENT .'/models/fields');
        $form = $this->loadForm(
                'com_something.enquiry',
                'enquiry',
                array('control' => 'jform', 'load_data' => $loadData
                ));
        return $form;
    }
   
    protected function loadFormData()
    {
        $data = (array)JFactory::getApplication()->getUserState('com_something.enquiry.data', array());
        return $data;
    }


Then on my view html I have:
    protected $form = null;
    $this->form        = $this->get('form');


I have even copied and pasted the helloworld xml form file in case mine was screwed still the same result.

I don't have anything else in my model (getTable etc), as the form has multiple tables to save to, I wanted to make use of JForm for ease of adding fields later and the validation. I was then going to create a task to save the data once validated to the correct tables.

The only difference from my other component is the get table, even adding that seems to not work either.

I am so annoyed that I spent time on something that should work. If anyone can help I would appreciate it. I did a search for 'no data' errors on jform but got no results on how to troubleshoot, or what it is trying to tell me, ie xml file is screwed or trying to load data from a pre-existant table or something????

Regards
Liam

Donald Gilbert

unread,
Jan 6, 2013, 7:07:38 PM1/6/13
to joomla-de...@googlegroups.com
What is the error text that you are getting? I may be able to help given that.



Liam

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/Vn8hMy058uMJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Liam Glanfield

unread,
Jan 7, 2013, 1:34:40 AM1/7/13
to joomla-de...@googlegroups.com

Hi, it just says 'no data' and it displayed in a 500 error page.

Debug seems to not give me any additional information.

Any ideas?

Thanks
Liam

Don

unread,
Jan 7, 2013, 2:19:14 AM1/7/13
to joomla-de...@googlegroups.com
Well that's weird. I can't think of why or where it would say "no data". Seems like a custom error message, as I've not seen it before. 

Usually 500 errors are pretty severe, so it dumps something into the error log. Van you check your servers php error log?

Sent from my iPhone

Liam Glanfield

unread,
Jan 7, 2013, 4:53:06 AM1/7/13
to joomla-de...@googlegroups.com

Checking the web server and php logs, I can not see any errors related to this.

I guess Joomla is raising the error somewhere. I think its best if I start from scratch and build a fresh view, will see if that works.

However I am out of ideas why its failing, I don't think I have done anything wrong. Am I right in thinking that you don't need a gettable function, it can work purely as a form?

Regards
Liam

Liam

unread,
Jan 7, 2013, 5:22:05 PM1/7/13
to joomla-de...@googlegroups.com
Ok rebuilt my view, controller and model. Still the same error my other component works ok.

Really frustrating spent a lot of time on this, now thinking that its going to be quicker to build the form by hand.

I can not find where the no data is coming from. If anyone can give me a working of example of how JForm should be used for a basic form, that would be great.

Thanks
LIam

Donald Gilbert

unread,
Jan 7, 2013, 5:27:03 PM1/7/13
to joomla-de...@googlegroups.com
Can you post a gist on http://gist.github.com of your code? or maybe zip it up and send it to me to review? I've had a lot of experience building custom forms using JForm, and think I could help.


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/o0R8VfxmWRwJ.
Reply all
Reply to author
Forward
0 new messages