Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2019-07-08 09:50 AM
There are two fields as below:
1. Please choose Yes/No,
2. If Yes, please specify, (text box)
If i chose "Yes" for 1, 2 gets displayed.
I want to clear out text box 2 if Yes is changed to No for 1.
2019-07-08 09:56 AM
Jhansi, you could do it either via a data feed, scheduled bulk update or custom object.
Advisory Consultant
2019-07-08 10:17 AM
Can you please help me with custom object?
2019-07-08 12:01 PM
Hi Jhansi -- What is the display control on the values list (drop down, radio buttons)? And is the text field a regular text field or a text area?
2019-07-08 01:58 PM
Hi Taylor,
What is the display control on the values list (drop down, radio buttons)? - IT is a drop down
And is the text field a regular text field or a text area? - regular text field.
2019-07-08 03:09 PM
Try this. It works for me in 6.4 SP1.
<script>
const yesNoFieldId = 21554; // Replace with the field ID of the Yes/No field
const textFieldId = 21552; // Replace with the field ID of the text field
const yes = 73754; // Replace with the ID of the 'Yes' value in the Yes/No field
const no = 73755; // Replace with the ID of the 'No' value in the Yes/No field
function setTextField(fld,val) {
var textFieldAttributes = new Array();
textFieldAttributes.push({
enabled: true,
emptyMessage: '',
validationText: val,
valueAsString: val,
lastSetTextBoxValue: val});
var textFieldAttributesSerialised = Sys.Serialization.JavaScriptSerializer.serialize(textFieldAttributes[0]);
$('input[id$="'+ fld +'c"]').val(val);
$('input[id$="'+ fld +'c_ClientState"]').val(textFieldAttributesSerialised);
}
Sys.Application.add_load(function() {
const yesNoClientId = $CM.getFieldById(yesNoFieldId).clientId;
$('div[id^="' + yesNoClientId + '"]').change(function() {
const yesOrNo = $CM.getFieldValue(yesNoFieldId);
if (yesOrNo !== null && yesOrNo[0] === no + ':0') {
setTextField(textFieldId, '');
}
});
});
</script>
2019-07-08 04:05 PM
Nice work Geoff
Word of caution, use the following function to set/clear a text field.
function setTextField(fld,val) {
var textFieldAttributes = new Array();
textFieldAttributes.push({
enabled: true,
emptyMessage: '',
validationText: val,
valueAsString: val,
lastSetTextBoxValue: val});
var textFieldAttributesSerialised = Sys.Serialization.JavaScriptSerializer.serialize(textFieldAttributes[0]);
$('input[id$="'+ fld +'c"]').val(val);
$('input[id$="'+ fld +'c_ClientState"]').val(textFieldAttributesSerialised);
}
Advisory Consultant
2019-07-09 08:33 AM
Thanks David! I had a feeling I wasn't doing that exactly the right way.
I updated my code with your function.
2019-07-17 09:32 AM
Hey David, somehow it is not working for me. can you please assist me some more details.
2019-07-17 09:35 AM
Hi Saumya
A few questions:
Advisory Consultant