JForm rendering HTML

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
Turbo2011
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Fri Jan 21, 2011 3:02 pm

JForm rendering HTML

Post by Turbo2011 » Tue Feb 01, 2011 5:23 pm

Hi,

im just writing an extension reading in jform xml data and displaying them on frontend site.
so is it possible to render the whole form with one function or do i have to iterate trough its elements?

Just something like:
$form = JForm::getInstance("name", "file.xml");
echo $form->render();


Thanks in advance...

 
realityking
Joomla! Explorer
Joomla! Explorer
Posts: 428
Joined: Fri May 21, 2010 11:43 am
Location: Aachen, Germany
Contact:

Re: JForm rendering HTML

Post by realityking » Wed Feb 02, 2011 7:31 am

You have to iterate trough them.

Turbo2011
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Fri Jan 21, 2011 3:02 pm

Re: JForm rendering HTML

Post by Turbo2011 » Thu Feb 03, 2011 7:41 am

Ok, got one more problem:
Please take a look at the example form xml descriptio at the bottom of this post first!

When loading an JForm XML description file, i can get all fields by method JForm/getFieldset() returning all fields as JFormField objects in an array, no matter they are within a fieldset or not. This is perfect so far, but what is missing is, that i dont know when to open a html fieldset tag, because i guess the information is not in the returned array.

I could use JFrom/getFieldsets() returning all fieldsets within the form, but then the fields who are not nested in fieldsets are missing, like the first one in this example xml.

so anybody know how to iterate trough the form, displaying all fields with fieldset information when they are nested in it.

Code: Select all

<form>
<fields>
<field type="text" name="field_without_fieldset"></field>
<fieldset>
<field type="text" name="field_with_fieldset"></field>
</fieldset>
</fields>
</form>
thanks

Turbo2011
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Fri Jan 21, 2011 3:02 pm

Re: JForm rendering HTML

Post by Turbo2011 » Thu Feb 03, 2011 7:43 am

i should add that i don't want to use this for backend forms or modul parameters. i want to display JForm's rendering in html to the frontend

 

Locked

Return to “Extensions for Joomla! 2.5”