- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 04:01 AM
Hi,
I am a newbie and not too good in scripting.
I am creating a Catalog item and there I have 2 check boxes, I want that only one can be selected at a time.
I know this can be done if I create radio buttons but I have been specifically asked to create checkboxes.
This is the onChange Client Script on function variable.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true){
g_form.setValue('menu','false');
}
This is the onChange Client Script on menu variable.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true){
g_form.setValue('function','false');
}
Can anyone help with the script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 05:56 AM
Last try,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true || newValue == 'true'){
alert("inside if");
g_form.setValue('menu', false);
}
}
//this is onchange client script on menu variable
if(newValue == true || newValue == 'true'){
alert("inside if");
g_form.setValue('fuction', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 05:14 AM
Hi ,
I have two checkboxes 'Menu' and 'Function'
This is the onChange Client Script on function variable.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true){
g_form.setValue('menu','false');
}
}
Similarly for menu checkbox, but this is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 05:44 AM
Please try as below,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true || newValue == 'true'){
g_form.setValue('menu',false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 05:52 AM
Hi Shweta,
I tried this, even now its not working.
// this is onchange client script on function variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true){
g_form.setValue('menu', false);
}
}
//this is onchange client script on menu variable
if (newValue == true){
g_form.setValue('fuction', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 05:56 AM
Last try,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
if(newValue == true || newValue == 'true'){
alert("inside if");
g_form.setValue('menu', false);
}
}
//this is onchange client script on menu variable
if(newValue == true || newValue == 'true'){
alert("inside if");
g_form.setValue('fuction', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2019 06:09 AM
thanks a lot shweta, it is working now.