0

I have created a custom field in Sitecore 9.0.1 as conditional rendering having One radio button and based on radio button selection i am showing and hiding the fields which are label and text box.

So my requirement is that when someone select yes then show TextBox that is mandatory and finally on Submission of the form I need that TextBox field value?

  • Sitecore 9.1 conditional rendering is out of box,better upgrade to latest Sitecore version. already one question is raised please check sitecore.stackexchange.com/questions/17998/…. – Abhishek Malaviya Jun 11 at 4:44
  • Could you please let me know how you are hiding/showing textbox? – Swati Gupta Jun 11 at 4:46
  • Hi @SwatiGupta Please find the script below, which I am using for show and hide functionality – kohila vani Jun 11 at 7:22
  • @kohilavani Sorry I did not find any script. Can you please script in your question? – Swati Gupta Jun 11 at 7:24
  • Hi @SwatiGupta Please find the script below $(document).on("click", ".sample", function () { var id = $(this).attr('id'); var clickedID = '#' + id; var conditions = $(clickedID).parent().parent().children('#Condition').val(); var classname = $(this).attr('class'); if (conditions == 'Yes' ) {if (conditions == 'Yes' && Action == "Enable" && Select ==TextBox") { $(clickedID).parent().parent().find('#divText').css('display', 'block');} and likewise i am checking other cases too. – kohila vani Jun 11 at 7:33
0

You can check logic in this link How to add Conditional field in sitecore 9 Form? where I am hiding Sections, you can hide text box.

To apply mandatory logic you can play with aria-required ,required,data-val attribute

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.