Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Add/Remove Required Attribute To Custom Code


Laeradeth

Question

Hello,

I'm hoping that someone out there may be able to assist me with getting this configured and working properly. I have a form with a couple of form fields that I have hidden and are coded to only appear based on certain answers from the previous question. For example:

"Lifetime Member?"

Yes = No Follow Up

No = Follow Up

My problem is that all of the information that we are asking requires an answer. I have Jquery installed and running but if I leave the required tag on the hidden fields then people will not be able to submit their answers. So I need to remove the required field from Squarespace but keep it required through Javascript and Jquery only if the questions are showing, if not then they would not be required and folks could submit their answers. I'm not sure if what I am trying to do is possible giving the limitations, but I'm hoping that someone out there may be able to assist me. Below is a copy of the code that I am using:
 

<script>
$('#radio-yui_3_17_2_1_1618750827688_273431 input').click(function() {
      selection = $(this).val();
      if (selection == 'No') {
        $('#date-yui_3_17_2_1_1618750827688_222457').show();
      }
      else {
        $('#date-yui_3_17_2_1_1618750827688_222457').hide();
      }
      });
$('#radio-yui_3_17_2_1_1618755633959_63568 input').click(function() {
      selection = $(this).val();
      if (selection == 'Yes') {
        $('#date-yui_3_17_2_1_1618755633959_64259').show();
      }
      else {
        $('#date-yui_3_17_2_1_1618755633959_64259').hide();
      }
    });
</script>

Link to post
  • Answers 0
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...