Multiselect Element Definition Missing + Doesn't Work on Front

6 views
Skip to first unread message

Phil -- wbtc.fr --

unread,
Mar 13, 2011, 10:40:27 AM3/13/11
to in-port...@googlegroups.com
Hi guys,

I'm testing now v512b2, and I discovered that while we can create a "multiple select" custom field in admin:

1- we can't display it on front using advanced theme, because we are missing this option element definition, we need to add

<inp2:m_DefineElement name="inp_edit_multioptions" has_empty="0" empty_value="" style="">
<td class="control-cell">
<select multiple tabindex="<inp2:m_get param='tab_index'/>" id="<inp2:{$prefix}_InputName field='$field'/>_select" onchange="update_multiple_options('<inp2:{$prefix}_InputName field='$field'/>');">
<inp2:m_if check="{$prefix}_FieldOption" field="$field" option="use_phrases">
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_phrase" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
<inp2:m_else/>
<inp2:{$prefix}_PredefinedOptions field="$field" block="inp_option_item" selected="selected" has_empty="$has_empty" empty_value="$empty_value"/>
</inp2:m_if>
</select>
<input type="hidden" id="<inp2:{$prefix}_InputName field='$field'/>" name="<inp2:{$prefix}_InputName field='$field'/>" value="<inp2:{$prefix}_Field field='$field' db='db'/>"/>
</td>
</inp2:m_DefineElement>

into platform/elements/forms/elm/tpl

2- choices aren't saved when using suggest_link.tpl in front

3- choices are saved correctly when done from admin side

4- how can we check if a value is choosen inside multiselect field, using inportal code, like

if_check field="" value="" condition="or" ?

thanks
Phil

Alexander Obuhovich

unread,
Mar 13, 2011, 12:54:51 PM3/13/11
to in-port...@googlegroups.com
2- choices aren't saved when using suggest_link.tpl in front

Do you have update_multiple_options javascript function, that is used in the block you've provided? If you don't have it, then you'll get js error instead of values being saved.


4- how can we check if a value is choosen inside multiselect field, using inportal code, like

No way to check for individual value being selected, only to check a full field value.


On Sun, Mar 13, 2011 at 4:40 PM, Phil -- wbtc.fr -- <ph...@wbtc.fr> wrote:
2- choices aren't saved when using suggest_link.tpl in front



Phil -- wbtc.fr --

unread,
Mar 13, 2011, 5:31:38 PM3/13/11
to in-port...@googlegroups.com
2- that's right, it works now :)

4- it's not so hard to achieve using custom JS, just wanted to know if we could use an inp tag, but it seems we can only check if custom field is empty or not, right?

2011/3/13 Alexander Obuhovich <aik....@gmail.com>
--
You received this message because you are subscribed to the Google Groups "In-Portal Bugs Team" group.
To post to this group, send email to in-port...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-bug...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-bugs?hl=en.

Alexander Obuhovich

unread,
Mar 13, 2011, 5:39:20 PM3/13/11
to in-port...@googlegroups.com
4 - yes. We can create a tag, to check that any of given option IDs is present within the field. It can be used for other purposes too.

Phil -- wbtc.fr --

unread,
Mar 13, 2011, 5:52:17 PM3/13/11
to in-port...@googlegroups.com
I think it could be usefull, idea here is to have advantage of multi select in admin/suggest, while using a more user-friendly display on front.
And more widely, having ability to check something inside a value could be usefull, don't you think so?

2011/3/13 Alexander Obuhovich <aik....@gmail.com>

Dmitry A.

unread,
Mar 13, 2011, 6:47:41 PM3/13/11
to in-port...@googlegroups.com
Hi guys,

I was actually fighting the same issues  for displaying multi check-boxes used in a single field with our Forms functionality and have worked out some Front-end Elements for it. The worse this was the JS part it's not very user friendly there so I am planning on posting an updated/improved version as part of our new Themes shortly.

I do agree with Alex that we might want to have a new Tag which will check if Option is selected so it can used in IF statements.


DA

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 6:29:45 AM3/14/11
to in-port...@googlegroups.com
That's exaclty what I'm trying to do: multi checkboxes in a single field.

Submitting shouldn't be too much hard, but conditional display needs a JS or a nice new tag :)

2011/3/13 Dmitry A. <dand...@gmail.com>

--

Alexander Obuhovich

unread,
Mar 14, 2011, 9:16:19 AM3/14/11
to in-port...@googlegroups.com
Actually we have this tag in In-Portal 5.1.1 version already. It's called "Selected". It is part of patch to "db_tag_processor.php" file in http://tracker.in-portal.org/view.php?id=427 task.

Here is how to use it. For example your field FieldName has value "|45|234234|3453|" in it.

To check, that "3453" is present within the field you must write this tags:

<inp2:m_if check="prefix_Selected" name="FieldName" value="3453">
     yes I got that value
</inp2:m_if>

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 9:22:18 AM3/14/11
to in-port...@googlegroups.com
it sounds really better than your first answer :-)

Let's see Dmitry's workaround for checkboxes to multiselect and this subject will be completly finished !

2011/3/14 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Mar 14, 2011, 9:32:51 AM3/14/11
to in-port...@googlegroups.com
You can already use Selected tag from that patch, since it works without cheating and workaround and it's completely official.

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 10:01:15 AM3/14/11
to in-port...@googlegroups.com
Well, I tried this:

<inp2:m_if check="l_Selected" name="cust_test" value="b">

to check a value inside a custom field named "test" in in-link.

While "b" value appears selected using the form element, it doesn't validate the check. Am I missing something?


2011/3/14 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Mar 14, 2011, 10:04:28 AM3/14/11
to in-port...@googlegroups.com
Do you have "b" in database too? You should write option value ID not it's title (what user sees near checkbox).

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 10:07:32 AM3/14/11
to in-port...@googlegroups.com
yes it works with the value ID, and it's really the way it should work, to keep multilingual functionnalities.

thanks !

Phil

unread,
Mar 14, 2011, 1:43:42 PM3/14/11
to In-Portal Bugs Team
I forgot to ask: how to display one of the values only? For example, I
want to see the value ID 1, I tried

<inp2:l_Field name="cust_test" value="1"/>

but no luck...

On 14 mar, 15:07, "Phil -- wbtc.fr --" <p...@wbtc.fr> wrote:
> yes it works with the value ID, and it's really the way it should work, to
> keep multilingual functionnalities.
>
> thanks !
>
> 2011/3/14 Alexander Obuhovich <aik.b...@gmail.com>
>
> > Do you have "b" in database too? You should write option value ID not it's
> > title (what user sees near checkbox).
>
> > On Mon, Mar 14, 2011 at 4:01 PM, Phil -- wbtc.fr -- <p...@wbtc.fr> wrote:
>
> >> Well, I tried this:
>
> >> <inp2:m_if check="l_Selected" name="cust_test" value="b">
>
> >> to check a value inside a custom field named "test" in in-link.
>
> >> While "b" value appears selected using the form element, it doesn't
> >> validate the check. Am I missing something?
>
> >> 2011/3/14 Alexander Obuhovich <aik.b...@gmail.com>
>
> >>> You can already use Selected tag from that patch, since it works without
> >>> cheating and workaround and it's completely official.
>
> >>> On Mon, Mar 14, 2011 at 3:22 PM, Phil -- wbtc.fr -- <p...@wbtc.fr>wrote:
>
> >>>> it sounds really better than your first answer :-)
>
> >>>> Let's see Dmitry's workaround for checkboxes to multiselect and this
> >>>> subject will be completly finished !
>
> >>>> 2011/3/14 Alexander Obuhovich <aik.b...@gmail.com>
>
> >>>>> Actually we have this tag in In-Portal 5.1.1 version already. It's
> >>>>> called "*Selected*". It is part of patch to "db_tag_processor.php"
> >>>>> file inhttp://tracker.in-portal.org/view.php?id=427task.
>
> >>>>> Here is how to use it. For example your field FieldName has value
> >>>>> "|45|234234|3453|" in it.
>
> >>>>> To check, that "3453" is present within the field you must write this
> >>>>> tags:
>
> >>>>> *<inp2:m_if check="prefix_Selected" name="FieldName" value="3453">*
> >>>>> *     yes I got that value*
> >>>>> *</inp2:m_if>*
>
> >>>>> On Mon, Mar 14, 2011 at 12:29 PM, Phil -- wbtc.fr -- <p...@wbtc.fr>wrote:
>
> >>>>>> That's exaclty what I'm trying to do: multi checkboxes in a single
> >>>>>> field.
>
> >>>>>> Submitting shouldn't be too much hard, but conditional display needs a
> >>>>>> JS or a nice new tag :)
>
> >>>>>> 2011/3/13 Dmitry A. <dandre...@gmail.com>
>
> >>>>>>  Hi guys,
>
> >>>>>>> I was actually fighting the same issues  for displaying multi
> >>>>>>> check-boxes used in a single field with our Forms functionality and have
> >>>>>>> worked out some Front-end Elements for it. The worse this was the JS part
> >>>>>>> it's not very user friendly there so I am planning on posting an
> >>>>>>> updated/improved version as part of our new Themes shortly.
>
> >>>>>>> I do agree with Alex that we might want to have a new *Tag* which

Alexander Obuhovich

unread,
Mar 14, 2011, 2:03:32 PM3/14/11
to in-port...@googlegroups.com
Since for checking individual value you need a special tag, then you need one for displaying it too. No such tag available if I recall correctly. It can easily be created based on Selected tag I've mentioned.

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 2:34:48 PM3/14/11
to in-port...@googlegroups.com
by "created", you mean a combination of existing tags?


2011/3/14 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Mar 14, 2011, 3:51:44 PM3/14/11
to in-port...@googlegroups.com
Yes, "create" means that it doesn't exist and needs to be created. Combination of existing tag or a new tag is just a matter of implementation.

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 4:02:02 PM3/14/11
to in-port...@googlegroups.com
but Combination is faster and doesn't need any patch :)

Any idea here? Sorry I'm not good enough to know all good combinations !

By the way, I have another question here, I'd like you to confirm my thoughts: could we use multiselect custom fields to store user entered value, for example in a suggest form?

Example, we could ask "what is the color?":
- black (radio or checkbox)
- blue (same)
- other color, please specify (this value will be entered in user's form)

(may this require another topic)

2011/3/14 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Mar 14, 2011, 5:08:26 PM3/14/11
to in-port...@googlegroups.com
No, all options are predefined and have ID=text mapping predefined in custom field declaration. What you are proposing could be done using 2 custom fields (multiselect and textbox).

Phil -- wbtc.fr --

unread,
Mar 14, 2011, 6:02:04 PM3/14/11
to in-port...@googlegroups.com
allright, thank you for explanation on this.

about tag to display id's value of a multiselect custom field, no -even small- idea?

I miss your good advices :)

2011/3/14 Alexander Obuhovich <aik....@gmail.com>

Alexander Obuhovich

unread,
Mar 15, 2011, 2:19:55 AM3/15/11
to in-port...@googlegroups.com
about tag to display id's value of a multiselect custom field, no -even small- idea?

What you mean, Phil? We don't have such a tag already?


On Tue, Mar 15, 2011 at 12:02 AM, Phil -- wbtc.fr -- <ph...@wbtc.fr> wrote:
about tag to display id's value of a multiselect custom field, no -even small- idea?



Phil -- wbtc.fr --

unread,
Mar 15, 2011, 3:30:54 AM3/15/11
to in-port...@googlegroups.com
well, may I mistake, but we can check if a value is present (with the tag you gave us), we can display all values (just calling the tag), but what if we want to display only a value of selected ID, after having checked if it's available with your tag?


2011/3/15 Alexander Obuhovich <aik....@gmail.com>

--

Alexander Obuhovich

unread,
Mar 15, 2011, 4:01:58 AM3/15/11
to in-port...@googlegroups.com
You mean you have "cust_test" field with value "|5|12|7|" and you wan't to display something when field have "|7|" within it? You can do that with Selected tag. No way to show phrase (from custom field definition), associated with that single ID though.

We actually create some tag, like <inp2:l_OptionValue name="FieldName" value="12"/> to show option label (or text), associated with given option ID. Now only PredefinedFieldOptions tag can do that, but it lists all (not single one) options instead. It also checks if a particular option is selected or not. Maybe you can use that PredefinedFieldOptions tag in some way.

Phil -- wbtc.fr --

unread,
Mar 15, 2011, 6:29:27 AM3/15/11
to in-port...@googlegroups.com
the OptionValue tag is definitivly the right one to solve my case, I'll wait for it :)

2011/3/15 Alexander Obuhovich <aik....@gmail.com>

Dmitry A.

unread,
Mar 21, 2011, 2:28:41 PM3/21/11
to in-port...@googlegroups.com
Hi Alex,


What about the new Tag which will do what Phil needs.

Would you please create a task for this and properly describe it so it's not lost here.


Thanks.


DA

Alexander Obuhovich

unread,
Mar 28, 2011, 11:02:00 AM3/28/11
to in-port...@googlegroups.com
Task: http://tracker.in-portal.org/view.php?id=1027

Ready for testing.

Also there was a bug in Selected tag, that should be usually used a long with OptionValue tag.

Both Selected and OptionValue tags combined will allow to render individual options of any field, that have them (e.g. multiple checkboxes, dropdowns).

I also demonstrated that in the patch I've attached to that task.



--
You received this message because you are subscribed to the Google Groups "In-Portal Bugs Team" group.
To post to this group, send email to in-port...@googlegroups.com.
To unsubscribe from this group, send email to in-portal-bug...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/in-portal-bugs?hl=en.
option_value_tag.patch

Phil -- wbtc.fr --

unread,
Mar 28, 2011, 11:44:11 AM3/28/11
to in-port...@googlegroups.com
wow, thank you for this excellent solution ! I'll test it immediatly :)

2011/3/28 Alexander Obuhovich <aik....@gmail.com>
Reply all
Reply to author
Forward
0 new messages