We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Freeform using jquery to update required fields

Development and Programming

aka1's avatar
aka1
1 posts
13 years ago
aka1's avatar aka1

Hello,

My freeform tag looks like this:

{exp:freeform:form collection="Submit-Ideas" notify="[email protected]" required="" template="comments" return="thank-you"}

I would like to be able to update which fields are required based on a radio button selection. Here is an example in jquery where I would like to set the email field as required:

$(document).ready(function(){
 $(".radioChoice2").click(function(){
     if ($('input[name=radioOption]:checked').val() == "Email" ) {
  $("form[form_name=Submit-Ideas]").attr("required", "email");      
        }
     });  
});

Has anyone tried anything similar or could point to what I am doing wrong. The required field does not get set

Thanks

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.