Default value to be hidden | XM Community
Skip to main content
Solved

Default value to be hidden

  • May 19, 2020
  • 4 replies
  • 51 views

JustinD

I am working with Text Entry.
I am trying to have a default response for any empty Text Entry to be "N/A" at the outcome.
Is there a way for a default value to be hidden so that if there is no response, it gets "N/A" as outcome (instead of having "N/A" inside Text Entry already)?

Best answer by JustinD

rondev Thanks a lot.
I guess we have to put the code individually on each question or is there anyway we could do it as "Custom Validation (which I am not familiar at this point)"?

4 replies

rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • 1450 replies
  • May 19, 2020

Use this code in jS onReady function. The below code will make text entry N/A if its empty, for all text entry input on that page.
jQuery("#NextButton").on('click',function(){

jQuery(".InputText").each(function(){
if(jQuery(this).val().trim()==""){jQuery(this).val("N/A");}
});

});


JustinD
  • Author
  • 32 replies
  • May 19, 2020

@rondev Thanks for the jQuery. I will apply it.
I have another question.
Regards to Required Field (Force Response), is there anyway to customize it to all questions together instead of getting a generic message "Please answer this question."?
I am trying to say "Please answer this question. If you do not have an answer, please indicate N/A" on all questions together.
Thanks.


rondev
Level 6 ●●●●●●
Forum|alt.badge.img+22
  • Level 6 ●●●●●●
  • 1450 replies
  • May 19, 2020

I have another question.:
Here is the code:
jQuery(".ValidationError").html("Please answer this question. If you do not have an answer, please indicate N/A");


JustinD
  • Author
  • 32 replies
  • Answer
  • May 19, 2020

rondev Thanks a lot.
I guess we have to put the code individually on each question or is there anyway we could do it as "Custom Validation (which I am not familiar at this point)"?