How to validate custom radio button in magento 2?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
In my custom module system.xml i added
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="Customodule" translate="label" sortOrder="10">
<label>Settings</label>
</tab>
<section id="ConnSettings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Connection Settings</label>
<tab>Customodule</tab>
<resource>Vendor_Customodule::config</resource>
<group id="first" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="accessLevel" translate="label" type="radios" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Access Level</label>
<source_model>VendorCustomModuleModelSourceAccessLevel</source_model>
</field>
Model file is as
class AccessLevel implements MagentoFrameworkOptionArrayInterface
public function toOptionArray()
return [
[
'value' => 'test',
'label' => __('Testing')
],
[
'value' => 'production',
'label' => __('Production')
],
];
I want to select Test option by default. What should i do pelase reply me?
magento2
 |Â
show 3 more comments
up vote
1
down vote
favorite
In my custom module system.xml i added
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="Customodule" translate="label" sortOrder="10">
<label>Settings</label>
</tab>
<section id="ConnSettings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Connection Settings</label>
<tab>Customodule</tab>
<resource>Vendor_Customodule::config</resource>
<group id="first" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="accessLevel" translate="label" type="radios" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Access Level</label>
<source_model>VendorCustomModuleModelSourceAccessLevel</source_model>
</field>
Model file is as
class AccessLevel implements MagentoFrameworkOptionArrayInterface
public function toOptionArray()
return [
[
'value' => 'test',
'label' => __('Testing')
],
[
'value' => 'production',
'label' => __('Production')
],
];
I want to select Test option by default. What should i do pelase reply me?
magento2
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
question edited
â iqbal malik
32 mins ago
 |Â
show 3 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
In my custom module system.xml i added
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="Customodule" translate="label" sortOrder="10">
<label>Settings</label>
</tab>
<section id="ConnSettings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Connection Settings</label>
<tab>Customodule</tab>
<resource>Vendor_Customodule::config</resource>
<group id="first" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="accessLevel" translate="label" type="radios" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Access Level</label>
<source_model>VendorCustomModuleModelSourceAccessLevel</source_model>
</field>
Model file is as
class AccessLevel implements MagentoFrameworkOptionArrayInterface
public function toOptionArray()
return [
[
'value' => 'test',
'label' => __('Testing')
],
[
'value' => 'production',
'label' => __('Production')
],
];
I want to select Test option by default. What should i do pelase reply me?
magento2
In my custom module system.xml i added
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="Customodule" translate="label" sortOrder="10">
<label>Settings</label>
</tab>
<section id="ConnSettings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Connection Settings</label>
<tab>Customodule</tab>
<resource>Vendor_Customodule::config</resource>
<group id="first" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<field id="accessLevel" translate="label" type="radios" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Access Level</label>
<source_model>VendorCustomModuleModelSourceAccessLevel</source_model>
</field>
Model file is as
class AccessLevel implements MagentoFrameworkOptionArrayInterface
public function toOptionArray()
return [
[
'value' => 'test',
'label' => __('Testing')
],
[
'value' => 'production',
'label' => __('Production')
],
];
I want to select Test option by default. What should i do pelase reply me?
magento2
magento2
edited 32 mins ago
asked 54 mins ago
iqbal malik
498
498
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
question edited
â iqbal malik
32 mins ago
 |Â
show 3 more comments
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
question edited
â iqbal malik
32 mins ago
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
question edited
â iqbal malik
32 mins ago
question edited
â iqbal malik
32 mins ago
 |Â
show 3 more comments
2 Answers
2
active
oldest
votes
up vote
3
down vote
Please add following code in your etc/config.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
add a comment |Â
up vote
2
down vote
Add this code in your config.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Remove value from core_config_data
table and upgrade and deploy.
This work for me thanks
â iqbal malik
22 mins ago
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Please add following code in your etc/config.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
add a comment |Â
up vote
3
down vote
Please add following code in your etc/config.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Please add following code in your etc/config.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Please add following code in your etc/config.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
edited 24 mins ago
answered 41 mins ago
Aasim Goriya
1,8951529
1,8951529
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
add a comment |Â
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
i tried this but nothing happened
â iqbal malik
38 mins ago
i tried this but nothing happened
â iqbal malik
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
please add your full system.xml code in your question.
â Aasim Goriya
38 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
@iqbalmalik is this working for you ?
â Aasim Goriya
21 mins ago
add a comment |Â
up vote
2
down vote
Add this code in your config.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Remove value from core_config_data
table and upgrade and deploy.
This work for me thanks
â iqbal malik
22 mins ago
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
add a comment |Â
up vote
2
down vote
Add this code in your config.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Remove value from core_config_data
table and upgrade and deploy.
This work for me thanks
â iqbal malik
22 mins ago
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Add this code in your config.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Remove value from core_config_data
table and upgrade and deploy.
Add this code in your config.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<ConnSettings>
<first>
<accessLevel>test</accessLevel>
</first>
</ConnSettings>
</default>
</config>
Remove value from core_config_data
table and upgrade and deploy.
answered 29 mins ago
Rohan Hapani
3,77821458
3,77821458
This work for me thanks
â iqbal malik
22 mins ago
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
add a comment |Â
This work for me thanks
â iqbal malik
22 mins ago
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
This work for me thanks
â iqbal malik
22 mins ago
This work for me thanks
â iqbal malik
22 mins ago
1
1
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
Happy to help :) Happy coding !! Please accept answer.
â Rohan Hapani
22 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
+1 for same ans as mine :)
â Aasim Goriya
12 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f245082%2fhow-to-validate-custom-radio-button-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Please add your group tag from system.xml in your question, so I will add full code with group id
â Aasim Goriya
38 mins ago
group tag id is "first"
â iqbal malik
37 mins ago
can you please add full code ?
â Aasim Goriya
36 mins ago
Please add your config.xml and system.xml code
â Rohan Hapani
33 mins ago
question edited
â iqbal malik
32 mins ago