New Subform Field #122

Closed
opened 2017-09-20 21:11:57 +00:00 by mwweb · 15 comments
mwweb commented 2017-09-20 21:11:57 +00:00 (Migrated from github.com)

I'm just checking...was the new subform field type supposed to be added to the fieldstype table? Checking, because I did the upgrade, and there is no subform field available. It was available in the branch before the merge.

I see it in the install sql file though. I'll manually add it, but thought that it would have inserted to the table.

I'm just checking...was the new subform field type supposed to be added to the fieldstype table? Checking, because I did the upgrade, and there is no subform field available. It was available in the branch before the merge. I see it in the install sql file though. I'll manually add it, but thought that it would have inserted to the table.

Subform has been part of the public JCB for some time now.

Let me get this straight... are you asking about the "subform" as a field type, or the fact that I converted all field types "properties" to a subform?

Subform has been part of the public JCB for some time now. Let me get this straight... are you asking about the "subform" as a field type, or the fact that I converted all field types "properties" to a subform?
mwweb commented 2017-09-20 21:22:57 +00:00 (Migrated from github.com)

As a new field type. I know subform had been discussed, but in looking after upgrading to 2.5.5, there was no subform field type.

I ended up exporting the fields from the branch build before merge, then importing into my "live" version of JCB, and it's there now.

If it's been available for a while, there must have been an update SQL that didn't run to add it.

As a new field type. I know subform had been discussed, but in looking after upgrading to 2.5.5, there was no subform field type. I ended up exporting the fields from the branch build before merge, then importing into my "live" version of JCB, and it's there now. If it's been available for a while, there must have been an update SQL that didn't run to add it.

IF you do a blank install of JCB you will see that the subform is actually there :) along all other field types... so we gave all field types to the community few months ago... I should actually update the demo component to make use of all field types so you could easy update your system...

IF you are speaking about the fact that if you open fieldtypes in JCB now... the properties are all in a subform, then yes that was done automatically since the field name did not change, nothing in the database will change. But you will see in the installer script of JCB we are doing a lot of house cleaning to insure all continues to work without conflict... even with the import and export of components we have made all known adjustments to try and move these fields to subforms and still be backward compatible. Hey this exercise was expensive... and why I only did the language view, and the fieldtypes... to see the impact. The impact was three days of debugging... little much to move from repeatable fields to subforms. But we made it... lets see if more things break, hope not :)

IF you do a blank install of JCB you will see that the subform is actually there :) along all other field types... so we gave all field types to the community few months ago... I should actually update the demo component to make use of all field types so you could easy update your system... IF you are speaking about the fact that if you open fieldtypes in JCB now... the properties are all in a subform, then yes that was done automatically since the field name did not change, nothing in the database will change. But you will see in the installer script of JCB we are doing a lot of house cleaning to insure all continues to work without conflict... even with the import and export of components we have made all known adjustments to try and move these fields to subforms and still be backward compatible. Hey this exercise was expensive... and why I only did the language view, and the fieldtypes... to see the impact. The impact was three days of debugging... little much to move from repeatable fields to subforms. But we made it... lets see if more things break, hope not :)
mwweb commented 2017-09-20 21:36:09 +00:00 (Migrated from github.com)

I'm actually referring to line 1000 in install.mysql.utf8.sql. This SQL add the Subform field type to componentbuilder_fieldtype.

I search through all the update queries, and the subform field is never added during an update.

So, if there is a NEW install, then the subform will get added, since it is part of install.mysql.utf8.sql. However, if JBC has already been installed, as is the case in my situation, then I would have never received the subform field type, since it was never a part of any updates.

I worked around that by exporting and importing the field types. But I just wanted to point out that subform isn't a part of updates.

I'm actually referring to line 1000 in install.mysql.utf8.sql. This SQL add the Subform field type to componentbuilder_fieldtype. I search through all the update queries, and the subform field is never added during an update. So, if there is a NEW install, then the subform will get added, since it is part of install.mysql.utf8.sql. However, if JBC has already been installed, as is the case in my situation, then I would have never received the subform field type, since it was never a part of any updates. I worked around that by exporting and importing the field types. But I just wanted to point out that subform isn't a part of updates.

Yea sorry, we never added the new fields to an SQL update.

Here is why, you can add your own fieldtypes right? So you could go look at the subform fieldtype and manually have added that, so if we then released a update that adds it again. We will have to do it via a php install script to insure we do not cause conflict with those who has started extending JCB on their own. At the time that was to expensive to do, so I just bumped the fields to the public repo... and moved on.

SO you are right it never was part of any SQL update. Happy that you got it to work 👍

Subforms are so much better then repeatable fields... hope it remains stable! They made a change to repeatable fields a while back and man did that mess things up for me. But okay we got it working again... just hate it when they break stuff to improve it... keeps us up at night :)

Yea sorry, we never added the new fields to an SQL update. Here is why, you can add your own fieldtypes right? So you could go look at the subform fieldtype and manually have added that, so if we then released a update that adds it again. We will have to do it via a php install script to insure we do not cause conflict with those who has started extending JCB on their own. At the time that was to expensive to do, so I just bumped the fields to the public repo... and moved on. SO you are right it never was part of any SQL update. Happy that you got it to work :+1: Subforms are so much better then repeatable fields... hope it remains stable! They made a change to repeatable fields a while back and man did that mess things up for me. But okay we got it working again... just hate it when they break stuff to improve it... keeps us up at night :)
mwweb commented 2017-09-20 21:51:04 +00:00 (Migrated from github.com)

I'll have to play with the subforms. I just changed one of my repeatable fields to a subform, and it broke everything on my component. It wasn't even showing my records in the list view, yet they were in the table.

I don't have the time right now to debug, so I'll just change it back to repeatable for now. I currently have 4 components in the works,and pulling 16 hour days I just can't debug right now. No errors, but a broken view/Views.

I'll have to play with the subforms. I just changed one of my repeatable fields to a subform, and it broke everything on my component. It wasn't even showing my records in the list view, yet they were in the table. I don't have the time right now to debug, so I'll just change it back to repeatable for now. I currently have 4 components in the works,and pulling 16 hour days I just can't debug right now. No errors, but a broken view/Views.

Hey take my advice... don't do it when you are pushed on time... they are not interchangeable at all!!!!

Hey take my advice... don't do it when you are pushed on time... they are not interchangeable at all!!!!

Yea they are nice... but they store the values differently, I mean completely differently.

Repeatable fields:

field1
    value1
    value2

field2
   value1
   value2

Subforms

row1
    field1 => value1
    field2 => vlaue2
row2
   field1 => value1
   field2 => value2

So you will need to convert the already stored values and then wherever you are using the values in custom code, you will need to change that as well.

Very painful indeed... and when you start everything breaks and you go down this deep dark valley lol... only attempt this if you have time!

Yea they are nice... but they store the values differently, I mean completely differently. Repeatable fields: ``` field1 value1 value2 field2 value1 value2 ``` Subforms ``` row1 field1 => value1 field2 => vlaue2 row2 field1 => value1 field2 => value2 ``` So you will need to convert the already stored values and then wherever you are using the values in custom code, you will need to change that as well. Very painful indeed... and when you start everything breaks and you go down this deep dark valley lol... only attempt this if you have time!
mwweb commented 2017-09-21 20:54:41 +00:00 (Migrated from github.com)

I decided to take the time late last night to change all of my repeatable fields over to subforms. Since repeatable fields are depreciated, and the conversion can be tricky, I decided it best to do the change now, before I formally release it.

It works nicely. I'll just have to work on laying it out different.

I decided to take the time late last night to change all of my repeatable fields over to subforms. Since repeatable fields are depreciated, and the conversion can be tricky, I decided it best to do the change now, before I formally release it. It works nicely. I'll just have to work on laying it out different.

Depreciated? Did I hear you right? are they going to dump that field type?

Depreciated? Did I hear you right? are they going to dump that field type?
mwweb commented 2017-09-21 23:01:15 +00:00 (Migrated from github.com)

Yes. According to the Joomla! docs, and the API it has been depreciated, and looks like it's going to be removed in version 4.0

https://docs.joomla.org/Repeatable_form_field_type
This field is deprecated
Thank you to use Subform form field type (in multiple mode) instead.

https://api.joomla.org/cms-3/classes/JFormFieldRepeatable.html
Form Field class for the Joomla Platform.

deprecated
Display a JSON loaded window with a repeatable set of sub fields

Yes. According to the Joomla! docs, and the API it has been depreciated, and looks like it's going to be removed in version 4.0 https://docs.joomla.org/Repeatable_form_field_type This field is deprecated Thank you to use Subform form field type (in multiple mode) instead. https://api.joomla.org/cms-3/classes/JFormFieldRepeatable.html Form Field class for the Joomla Platform. deprecated Display a JSON loaded window with a repeatable set of sub fields

Well now we all have to insure to remove repeatable field from all the components we used it in... man this is just sick!!!!

How does this kind of thing happen? I just shake my head in utter disbelieve. Maybe I am working for the wrong community... they don't seem to value other peoples time.

Well now we all have to insure to remove **repeatable** field from all the components we used it in... man this is just sick!!!! How does this kind of thing happen? I just shake my head in utter disbelieve. Maybe I am working for the wrong community... they don't seem to value other peoples time.
imaziofa commented 2018-12-11 14:43:58 +00:00 (Migrated from github.com)

Hi, Is there a way to write javascript for the subform. I want to be able to program certain behavior for some of the fields as the rows are added dynamically.

Hi, Is there a way to write javascript for the subform. I want to be able to program certain behavior for some of the fields as the rows are added dynamically.

add the function call to the onchange property, like this:

myFunctionCall(this);

Then in your function call do this to get the row details by id:

// little script to check values and make changes to other fields
function myFunctionCall(field) {
	// get the ID
	var id = jQuery(field).attr('id');
	var target = id.split('__');
	//set the subID
	var subID = target[0]+'__'+target[1];
	// get value
	var value = jQuery('#'+subID+'__other_fieldname_in_same_row').val();
	// set notice and do house cleaning
	if (2 == value) {
		// do your thing...
	}
}

There are other ways to also do this... but this feature above works very well, the other way is explained here.

add the function call to the **onchange** property, like this: ``` myFunctionCall(this); ``` Then in your function call do this to get the row details by id: ``` // little script to check values and make changes to other fields function myFunctionCall(field) { // get the ID var id = jQuery(field).attr('id'); var target = id.split('__'); //set the subID var subID = target[0]+'__'+target[1]; // get value var value = jQuery('#'+subID+'__other_fieldname_in_same_row').val(); // set notice and do house cleaning if (2 == value) { // do your thing... } } ``` There are other ways to also do this... but this feature above works very well, the other way is [explained here](https://docs.joomla.org/Subform_form_field_type).
ilhan-uncuoglu commented 2020-10-02 08:29:17 +00:00 (Migrated from github.com)

And, where should i put that function?

add the function call to the onchange property, like this:

myFunctionCall(this);

Then in your function call do this to get the row details by id:

// little script to check values and make changes to other fields
function myFunctionCall(field) {
	// get the ID
	var id = jQuery(field).attr('id');
	var target = id.split('__');
	//set the subID
	var subID = target[0]+'__'+target[1];
	// get value
	var value = jQuery('#'+subID+'__other_fieldname_in_same_row').val();
	// set notice and do house cleaning
	if (2 == value) {
		// do your thing...
	}
}

There are other ways to also do this... but this feature above works very well, the other way is explained here.

And, where should i put that function? > > > add the function call to the **onchange** property, like this: > > ``` > myFunctionCall(this); > ``` > > Then in your function call do this to get the row details by id: > > ``` > // little script to check values and make changes to other fields > function myFunctionCall(field) { > // get the ID > var id = jQuery(field).attr('id'); > var target = id.split('__'); > //set the subID > var subID = target[0]+'__'+target[1]; > // get value > var value = jQuery('#'+subID+'__other_fieldname_in_same_row').val(); > // set notice and do house cleaning > if (2 == value) { > // do your thing... > } > } > ``` > > There are other ways to also do this... but this feature above works very well, the other way is [explained here](https://docs.joomla.org/Subform_form_field_type).
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#122
No description provided.