Submit specific <select> tag in a field

More
10 years 3 months ago #44098 by joomla_user
Hello,

I've created my own field type, it has mulitple <select> tags (im using AJAX to update other select list tags), one of them i want to save as it is the relevant one, problem is data from other <select>
list is saved, my question is how flexi determines what select to sumbit and save in the DB ?

thanks,

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #44101 by ggppdk
Hello

a form field is save if it is
- it is a FLEXIcontent field that is assigned to current article Content Type
- it's form field name is correct


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #44107 by joomla_user
- The field is assigned to current content type (since im able to save other <select> tags data)
- And what is the correct form field name ?

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #44110 by ggppdk
Hello

that comment was meant for form fields that are not added manual, in this case the field name is correct, see e.g. name created for a text field or weblink field or a select field

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #44118 by joomla_user
Hi,

My field type is based on the relation field (related items), which have 3 visible select tags (and few hidden), so i been looking the for an answer there.
Every item added to the "Related items" is saved regardless to what i have selected in other select tags..(category and category items) this is the behavior i want to apply to my specific select(i have five). When i look at this select(relation) i see that when you press ADD item, the item added to two select tags, one visible and the other is not :
(relation.php line ~357)
Code:
jQuery('#btn-add_".$ri_field_name."').click(function(){ jQuery('#".$ri_field_name."_visitems option:selected').each( function() { jQuery('#".$ri_field_name."_selitems').append(\"<option class='\"+jQuery(this).attr('class')+\"' value='\"+jQuery(this).val()+\"'>\"+jQuery(this).text()+\"</option>\"); // jQuery('#".$ri_field_name."').append(\"<option selected='selected' class='\"+jQuery(this).attr('class')+\"' value='\"+jQuery(this).val()+\"'>\"+jQuery(this).text()+\"</option>\"); jQuery(this).remove(); }); });
one with id = '#".$ri_field_name."_selitems' (visible)
and the other id = '#".$ri_field_name."' (hidden)
My guess is that the select tag with "name" property = $fieldname
(whereas $fieldname= FLEXI_J16GE ? 'custom[]' : $field->name.'[]';) is the one submitted ?? i.e. <select id="id" name="$fieldname
"> </select>
Thats why i think the hidden one is the one submitted and saved in DB.
Am i correct ?

Thanks..

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #44120 by joomla_user
Issue solved !
name attribute needs to start with $fieldname , i.e. name=$fieldname ,
but my problem was that the values must be "selected" and mine was not, this is why, by the way, there was 2 select tags in relation field, one only for display (so user cant make them "unselected" by mistake) and the other one (hidden, values always "selected") is for submission.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.826 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline