1. anakthewolf
  2. Support
  3. Friday, September 05 2014, 01:22 AM
Hi, I have a SelectList where I have 20 options (italian regions name).

For each option I have to set a condition: please Is possible manage this, by increasing $condition_suffix from 9 to 15 in helper.php (or other php script)?

It is not important to see it from the control panel, it is sufficient it's ok on frontend: I have made a Perl script to import xlsx data into db table jsn_fields, writing selectlist and params field directly on mysql in json format and update jsn_users table.

Please, reply me soon :) Thank you

Mario
anakthewolf Accepted Answer
Content Protected
  1. more than a month ago
  2. Support
  3. # 1
anakthewolf Accepted Answer
better...

$condition_suffix=array('','1','2','3','4','5','6','7','8','9');

for ($element=10;$element<151;$element++) {
array_push($condition_suffix,$element);
}

and. for field.xml


use strict;
use warnings;
use feature 'say';

my $xmlField;
open my $fh,'>','fieldGroup.xml' or die $_;

for (my $counter=10;$counter<151;$counter++) {

my $xmlField=<<XML;
<field name="spacer_conditions$counter" label="COM_JSN_CONDITION_LABEL" type="spacer" ></151>
<field
name="condition_operator$counter"
label="COM_JSN_CONDITION_OPERATOR"
description ="COM_JSN_CONDITION_OPERATOR_DESC"
type="list"
>
<option value="0">COM_JSN_CONDITION_DISABLED</option>
<option value="1">COM_JSN_CONDITION_EQUAL</option>
<option value="2">COM_JSN_CONDITION_GREATER</option>
<option value="3">COM_JSN_CONDITION_LESS</option>
<option value="4">COM_JSN_CONDITION_CONTAINS</option>
<option value="5">COM_JSN_CONDITION_NOTEQUAL</option>
<option value="6">COM_JSN_CONDITION_NOTCONTAINS</option>
</field>
<field
name="condition_field$counter"
label="COM_JSN_CONDITION_TO"
description ="COM_JSN_CONDITION_TO_DESC"
type="parent"
table="jsn_fields"
level="2"

field_id="alias"

>
<option value="_custom">COM_JSN_CUSTOM_VALUE</option>
</field>
<field
name="condition_custom$counter"
label="COM_JSN_CONDITION_CUSTOMVALUE"
description ="COM_JSN_CONDITION_CUSTOMVALUE_DESC"
type="text"
></field>
<field
name="condition_hide$counter"
label="COM_JSN_CONDITION_HIDE"
description ="COM_JSN_CONDITION_HIDE_DESC"
type="parent"
table="jsn_fields"
level="2"

field_id="alias"
multiple="true"
></field>

<field
name="condition_action$counter"
type="radio" class="btn-group"
label="COM_JSN_CONDITION_ACTION"
description="COM_JSN_CONDITION_ACTION_DESC"
default="hide"
>
<option value="hide">JHIDE</option>
<option value="show">JSHOW</option>
</field>

<field
name="condition_usergroups$counter"
type="usergroup"
multiple="true"
label="COM_JSN_CONDITION_USERGROUPS"
description="COM_JSN_CONDITION_USERGROUPS_DESC"
default="0"
>
</field>
XML
print $fh $xmlField."\n\n";

}
close $fh;
say 'xml condition maked!';
  1. more than a month ago
  2. Support
  3. # 2
admin Accepted Answer
Admin
To add more conditions you can do this:

$condition_suffix=array('','1','2','3','4','5','6','7','8','9','10','11',....);

add more conditions like this at:
at file /plugins/system/jsn_system/jsn_system.php at line 288
at file /plugins/jsn/usergroups/usergroups.php at line 37
at file /components/com_jsn/helpers/helper.php at line 213
at file /administrator/components/com_jsn/views/field/tmpl/edit.php at line 52

You must to add XML condition into file /administrator/components/com_jsn/models/forms/field.xml at line 1024 like this for each new condition
<field name="spacer_conditions10" label="COM_JSN_CONDITION_LABEL" type="spacer" />
<field
name="condition_operator10"
label="COM_JSN_CONDITION_OPERATOR"
description ="COM_JSN_CONDITION_OPERATOR_DESC"
type="list"
>
<option value="0">COM_JSN_CONDITION_DISABLED</option>
<option value="1">COM_JSN_CONDITION_EQUAL</option>
<option value="2">COM_JSN_CONDITION_GREATER</option>
<option value="3">COM_JSN_CONDITION_LESS</option>
<option value="4">COM_JSN_CONDITION_CONTAINS</option>
<option value="5">COM_JSN_CONDITION_NOTEQUAL</option>
<option value="6">COM_JSN_CONDITION_NOTCONTAINS</option>
</field>
<field
name="condition_field10"
label="COM_JSN_CONDITION_TO"
description ="COM_JSN_CONDITION_TO_DESC"
type="parent"
table="jsn_fields"
level="2"

field_id="alias"

>
<option value="_custom">COM_JSN_CUSTOM_VALUE</option>
</field>
<field
name="condition_custom10"
label="COM_JSN_CONDITION_CUSTOMVALUE"
description ="COM_JSN_CONDITION_CUSTOMVALUE_DESC"
type="text"
/>
<field
name="condition_hide10"
label="COM_JSN_CONDITION_HIDE"
description ="COM_JSN_CONDITION_HIDE_DESC"
type="parent"
table="jsn_fields"
level="2"

field_id="alias"
multiple="true"
/>

<field
name="condition_action10"
type="radio" class="btn-group"
label="COM_JSN_CONDITION_ACTION"
description="COM_JSN_CONDITION_ACTION_DESC"
default="hide"
>
<option value="hide">JHIDE</option>
<option value="show">JSHOW</option>
</field>

<field
name="condition_usergroups10"
type="usergroup"
multiple="true"
label="COM_JSN_CONDITION_USERGROUPS"
description="COM_JSN_CONDITION_USERGROUPS_DESC"
default="0"
>
</field>

  1. more than a month ago
  2. Support
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.