Hide/Show Fields on Add Record
Hide/Show Fields on Add Record
Hi.
How can I show a hidden field (hidden in detail view (add record)) called 'text' when check box "show_text" has been clicked.
i.e. When adding a record in table_b I want the 'text' field hidden and only shown when "show_text" had been checked.
I also want the text field shown in detail view and table view if checked.
I have checked the forums with similar questions suggesting to add Java code to the 'tablename'-dv.js file in the hooks folder.
I've tried the below code with various alterations but to no avail... please note I don't know how to use Java.
/* hide unhide fields */
$j(function() {
if ($j("input#show_text").click(":checked")) {
$j("label[for='text']").show();}
})
How can I show a hidden field (hidden in detail view (add record)) called 'text' when check box "show_text" has been clicked.
i.e. When adding a record in table_b I want the 'text' field hidden and only shown when "show_text" had been checked.
I also want the text field shown in detail view and table view if checked.
I have checked the forums with similar questions suggesting to add Java code to the 'tablename'-dv.js file in the hooks folder.
I've tried the below code with various alterations but to no avail... please note I don't know how to use Java.
/* hide unhide fields */
$j(function() {
if ($j("input#show_text").click(":checked")) {
$j("label[for='text']").show();}
})
Re: Hide/Show Fields on Add Record
Hi,
how do you hide the field in detail view?
For your function, use
how do you hide the field in detail view?
For your function, use
Code: Select all
$j("#show_text").on('change', function () {
// if you want to show only the label
if ($(this).is(':checked')) {
$j("label[for='text']").show();
}
else {
$j("label[for='text']").hide();
}
})
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Hi pbottcher.
Thank you for a quick reply.
I have tried this in the <tablename>-dv.js file but does not show the field when 'show_text' is checked.
When I add a record and then check 'show_text' I want to see the 'text' field otherwise hide.
I only want to see the 'text' field in detail view and table view if 'show_text' is checked.
Thank you in advance.
Thank you for a quick reply.
I have tried this in the <tablename>-dv.js file but does not show the field when 'show_text' is checked.
When I add a record and then check 'show_text' I want to see the 'text' field otherwise hide.
I only want to see the 'text' field in detail view and table view if 'show_text' is checked.
Thank you in advance.
- Attachments
-
- Screen shot of add record for table_b
- save_text.PNG (11.14 KiB) Viewed 4631 times
Re: Hide/Show Fields on Add Record
Hi,
you did not answer the question.
how do you hide the field in detail view?
you did not answer the question.
how do you hide the field in detail view?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Hi.
Sorry, I did not answer...
I have initially hidden the field in Appgini so that it does not show on add record.
Sorry, I did not answer...
I have initially hidden the field in Appgini so that it does not show on add record.
- Attachments
-
- save_text.hide.PNG (15.53 KiB) Viewed 4611 times
Re: Hide/Show Fields on Add Record
Hi,
if you use this feature, it is not possible to show the field, as the generated code will not have this field in the DV anymore.
So if you want to implement such a feature, you need to uncheck this feature and hide the field via JS through the hooks files, depending on your workflow.
if you use this feature, it is not possible to show the field, as the generated code will not have this field in the DV anymore.
So if you want to implement such a feature, you need to uncheck this feature and hide the field via JS through the hooks files, depending on your workflow.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Hi.
I have unticked the [ ]Hide in details view but the text box is still showing when I click add record.
So if I tick whilst in add record screen it should show and untick it should be hidden, can this be done with the code in the dv.js file?
I have unticked the [ ]Hide in details view but the text box is still showing when I click add record.
So if I tick whilst in add record screen it should show and untick it should be hidden, can this be done with the code in the dv.js file?
Code: Select all
$j("#show_text").on('change', function () {
// if you want to show only the label
if ($(this).is(':checked')) {
$j("label[for='text']").show();
}
else {
$j("label[for='text']").hide();
}
})
- Attachments
-
- save_text.hidden.PNG (9.23 KiB) Viewed 4605 times
Re: Hide/Show Fields on Add Record
Hi,
add a
$j("#show_text").parents('.form-group').hide();
at the beginning, before the
$j("#show_text").on('change', function () {
....
Also I would expect that
$j("label[for='text']").show(); $j("label[for='text']").hide();
will only hide the label, but not the text.
try rather:
$j("label[for='text']").parent('.form-group').show(); $j("label[for='text']").parent('.form-group').hide();
add a
$j("#show_text").parents('.form-group').hide();
at the beginning, before the
$j("#show_text").on('change', function () {
....
Also I would expect that
$j("label[for='text']").show(); $j("label[for='text']").hide();
will only hide the label, but not the text.
try rather:
$j("label[for='text']").parent('.form-group').show(); $j("label[for='text']").parent('.form-group').hide();
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Hi,
I have amended the code and now it is working!
However, after saving the record and then clicking on the record again the text field is hidden so to see the text I have to uncheck and then check the 'Show_text' field.
I have amended the code and now it is working!
However, after saving the record and then clicking on the record again the text field is hidden so to see the text I have to uncheck and then check the 'Show_text' field.
Code: Select all
$j("#text").parents('.form-group').hide();
$j("#show_text").on('change', function () {
// if you want to show only the label
if ($j(this).is(':checked')) {
$j("label[for='text']").parent('.form-group').show();
}
else {
$j("label[for='text']").parent('.form-group').hide();
}
});
- Attachments
-
- After Record Added and in Detail View
- after add record.PNG (9.6 KiB) Viewed 4594 times
-
- Add Record
- add record.PNG (8.81 KiB) Viewed 4594 times
Re: Hide/Show Fields on Add Record
Hi,
this is obvious, as you need to check of course the actual status of the field when the DV is opend.
So try
this is obvious, as you need to check of course the actual status of the field when the DV is opend.
So try
Code: Select all
if (!$j("#text").is('checked')) {
$j("#text").parents('.form-group').hide();
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Hi.
I added the code to the beginning of the DV file but the '#text' field is still not visible when '#show_text' is checked.
I thought the 1st line should be '#show_text' so I tried this too but this did not work either.
I added the code to the beginning of the DV file but the '#text' field is still not visible when '#show_text' is checked.
I thought the 1st line should be '#show_text' so I tried this too but this did not work either.
Code: Select all
if (!$j("#text").is('checked')) {
$j("#text").parents('.form-group').hide();
}
$j("#show_text").on('change', function () {
// if you want to show only the label
if ($j(this).is(':checked')) {
$j("label[for='text']").parent('.form-group').show();
}
else {
$j("label[for='text']").parent('.form-group').hide();
}
});
- Attachments
-
- Capture.PNG (2.47 KiB) Viewed 4571 times
Re: Hide/Show Fields on Add Record
Hi,
true, of course it needs to be show_text. Aslo I missed to put the :, so please change it to
true, of course it needs to be show_text. Aslo I missed to put the :, so please change it to
Code: Select all
if (!$j("#show_text").is(':checked')) {
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Hide/Show Fields on Add Record
Excellent.
All works as expected, thank you so much for your time.
All works as expected, thank you so much for your time.