Skip to content

Instantly share code, notes, and snippets.

@alpha1
Last active August 29, 2015 14:15
Show Gist options
  • Save alpha1/da03415c1ba8a87c6f9d to your computer and use it in GitHub Desktop.
Save alpha1/da03415c1ba8a87c6f9d to your computer and use it in GitHub Desktop.
Gravity Forms Doesn't Play Well With Checking Checkboxes using dynamic population
{"0":{"title":"Edit Profile","description":"User Edit Profile","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Update","imageUrl":""},"fields":[{"type":"hidden","adminLabel":"","adminOnly":"","allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":16,"inputName":"saved","isRequired":false,"label":"Hidden Field","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"html","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"[alert type=\"success\" accent_color=\"\" background_color=\"\" border_size=\"1px\" icon=\"fa-check-circle-o\" box_shadow=\"no\" animation_type=\"fade\" animation_direction=\"down\" animation_speed=\"0.1\" class=\"\" id=\"\"]Your Personal Profile has been successfully updated.[\/alert]","cssClass":"","errorMessage":"","id":17,"inputName":"","isRequired":false,"label":"HTML Block","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","displayOnly":true,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"16","operator":"is","value":"profile"}]},"formId":23,"descriptionPlacement":"below","choices":""},{"type":"section","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":9,"inputName":"","isRequired":false,"label":"Personal Information","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","displayOnly":true,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":""},{"type":"name","adminLabel":"","adminOnly":"","allowsPrepopulate":"","defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":13,"inputName":"","isRequired":false,"label":"Name","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":"","displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":[{"id":13.3,"label":"First","name":""},{"id":13.6,"label":"Last","name":""}],"nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{user:company}","description":"","content":"","cssClass":"gf_left_half","errorMessage":"","id":4,"inputName":"","isRequired":false,"label":"Company","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","choices":"","conditionalLogic":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{user:job_title}","description":"","content":"","cssClass":"gf_right_half","errorMessage":"","id":5,"inputName":"","isRequired":false,"label":"Job Title","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"email","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{user:user_email}","description":"","content":"","cssClass":"gf_left_half","errorMessage":"","id":3,"inputName":"","isRequired":false,"label":"Email","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{user:phone}","description":"","content":"","cssClass":"gf_right_half","errorMessage":"","id":6,"inputName":"","isRequired":false,"label":"Phone","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","choices":"","conditionalLogic":"","displayOnly":""},{"type":"section","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":8,"inputName":"","isRequired":false,"label":"Update Password","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","displayOnly":true,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":""},{"type":"password","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":7,"inputName":"","isRequired":false,"label":"Password","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","displayOnly":true,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":""},{"type":"section","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":10,"inputName":"","isRequired":false,"label":"Marketing Profile","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","displayOnly":true,"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":""},{"type":"radio","adminLabel":"","adminOnly":"","allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"gf_left_half","errorMessage":"","id":11,"inputName":"marketing_role","isRequired":false,"label":"What's your role in Marketing?","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","choices":[{"text":"Industry Marketer","value":"Industry Marketer","isSelected":false,"price":""},{"text":"Public Relations Firm","value":"Public Relations Firm","isSelected":false,"price":""},{"text":"Media Buyer \/ Ad Agency","value":"Media Buyer \/ Ad Agency","isSelected":false,"price":""}],"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","enableOtherChoice":true,"formId":23,"descriptionPlacement":"below","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","conditionalLogic":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"gf_right_half","errorMessage":"","id":12,"inputName":"","isRequired":false,"label":"Your Client","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"11","operator":"isnot","value":"Industry Marketer"}]},"formId":23,"descriptionPlacement":"below","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","choices":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{user:Comapny Website}","description":"","content":"","cssClass":"","errorMessage":"","id":18,"inputName":"","isRequired":false,"label":"Company Website","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"address","adminLabel":"","adminOnly":"","allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":14,"inputName":"","isRequired":false,"label":"Address","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","addressType":"international","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":false,"hideCountry":false,"hideState":false,"inputs":[{"id":14.1,"label":"Street Address","name":"shipping_address_1"},{"id":14.2,"label":"Address Line 2","name":"shipping_address_2"},{"id":14.3,"label":"City","name":"shipping_city"},{"id":14.4,"label":"State \/ Province","name":"shipping_state"},{"id":14.5,"label":"ZIP \/ Postal Code","name":"shipping_postcode"},{"id":14.6,"label":"Country","name":"shipping_country"}],"nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","formId":23,"descriptionPlacement":"below","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","choices":"","conditionalLogic":"","displayOnly":""},{"type":"hidden","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"{date_mdy}","description":"","content":"","cssClass":"","errorMessage":"","id":15,"inputName":"","isRequired":false,"label":"Last Modified Date","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","formId":23,"descriptionPlacement":"below","choices":"","conditionalLogic":"","displayOnly":""},{"type":"checkbox","adminLabel":"","adminOnly":false,"allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":19,"inputName":"section","isRequired":true,"label":"What is the marketers' primary business? (Please check all that apply)","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":[{"id":"19.1","label":"Building Products","name":""},{"id":"19.2","label":"Construction Equipment, Vehicles or Tools","name":""},{"id":"19.3","label":"Professional or Consulting Services","name":""},{"id":"19.4","label":"Technology, Software or Hardware","name":""},{"id":"19.5","label":"Construction, Engineering or Design Capabilities","name":""}],"nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","choices":[{"text":"Building Products","value":"Building Products","isSelected":false,"price":""},{"text":"Construction Equipment, Vehicles or Tools","value":"Equipment Trucks and Tools","isSelected":false,"price":""},{"text":"Professional or Consulting Services","value":"Professional Services","isSelected":false,"price":""},{"text":"Technology, Software or Hardware","value":"Technology","isSelected":false,"price":""},{"text":"Construction, Engineering or Design Capabilities","value":"Construction Capabilities","isSelected":false,"price":""}],"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":false,"salesforceMapField":false,"salesforceMapType":"live","enableChoiceValue":true,"formId":23,"descriptionPlacement":"below","conditionalLogic":"","displayOnly":""},{"type":"text","adminLabel":"","adminOnly":true,"allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":20,"inputName":"","isRequired":false,"label":"Untitled","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","formId":23,"descriptionPlacement":"below","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":false,"salesforceMapField":false,"salesforceMapType":"live","choices":"","conditionalLogic":"","displayOnly":""},{"type":"checkbox","adminLabel":"","adminOnly":false,"allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"gf_list_3col","errorMessage":"","id":21,"inputName":"target_audience","isRequired":false,"label":"Target Audience (Please check all that apply)","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":[{"id":"21.1","label":"Architects","name":""},{"id":"21.2","label":"Contractors (General)","name":""},{"id":"21.3","label":"Contractors (Specialty)","name":""},{"id":"21.4","label":"Engineers","name":""},{"id":"21.5","label":"Owners (Public Sector)","name":""},{"id":"21.6","label":"Owners (Private Sector)","name":""},{"id":"21.7","label":"Project Managers","name":""},{"id":"21.8","label":"Other (Please Specify)","name":""}],"nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","choices":[{"text":"Architects","value":"Architects","isSelected":false,"price":""},{"text":"Contractors (General)","value":"Contractors (General)","isSelected":false,"price":""},{"text":"Contractors (Specialty)","value":"Contractors (Specialty)","isSelected":false,"price":""},{"text":"Engineers","value":"Engineers","isSelected":false,"price":""},{"text":"Owners (Public Sector)","value":"Owners (Public Sector)","isSelected":false,"price":""},{"text":"Owners (Private Sector)","value":"Owners (Private Sector)","isSelected":false,"price":""},{"text":"Project Managers","value":"Project Managers","isSelected":false,"price":""},{"text":"Other (Please Specify)","value":"Other (Please Specify)","isSelected":false,"price":""}],"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":"","salesforceMapField":false,"salesforceMapType":"live","conditionalLogic":"","formId":23,"descriptionPlacement":"below","enableChoiceValue":true,"displayOnly":""},{"type":"text","adminLabel":"","adminOnly":"","allowsPrepopulate":false,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":22,"inputName":"","isRequired":false,"label":"Who is your target Audience (Write In)","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":false,"salesforceMapField":false,"salesforceMapType":"live","formId":23,"descriptionPlacement":"below","conditionalLogic":{"actionType":"show","logicType":"all","rules":[{"fieldId":"21","operator":"is","value":"Other (Please Specify)"}]},"choices":"","displayOnly":""},{"type":"select","adminLabel":"","adminOnly":"","allowsPrepopulate":true,"defaultValue":"","description":"","content":"","cssClass":"","errorMessage":"","id":23,"inputName":"_sf_category","isRequired":false,"label":"Please choose the category that best describes the marketer's products and services","noDuplicates":"","size":"medium","postCustomFieldName":"","displayAllCategories":false,"displayCaption":"","displayDescription":"","displayTitle":"","inputType":"","rangeMin":"","rangeMax":"","calendarIconUrl":"","dateFormat":"","phoneFormat":"","defaultCountry":"","defaultProvince":"","defaultState":"","hideAddress2":"","hideCountry":"","hideState":"","inputs":"","nameFormat":"","allowedExtensions":"","captchaType":"","captchaTheme":"","simpleCaptchaSize":"","simpleCaptchaFontColor":"","simpleCaptchaBackgroundColor":"","failed_validation":"","productField":"","enablePasswordInput":"","maxLength":"","enablePrice":"","basePrice":"","choices":[{"text":"Please Select a Category","value":"--","isSelected":false,"price":""},{"text":"Building Product Manufacturer","value":"Building Product Manufacturer","isSelected":false,"price":""},{"text":"Construction Capabilities","value":"Capabilities","isSelected":false,"price":""},{"text":"Construction Equipment","value":"Construction Equipment","isSelected":false,"price":""},{"text":"Consulting Services","value":"Consulting Services","isSelected":false,"price":""},{"text":"Distributor","value":"Distributor","isSelected":false,"price":""},{"text":"Education and Training","value":"Education and Training","isSelected":false,"price":""},{"text":"Facility Operations & Maintenance","value":"Facility Operations & Maintenance","isSelected":false,"price":""},{"text":"Financial Services","value":"Financial Services","isSelected":false,"price":""},{"text":"Green Construction","value":"Green Construction","isSelected":false,"price":""},{"text":"Interior Furnishings","value":"Interior Furnishings","isSelected":false,"price":""},{"text":"Mobile Offices and Modular Buildings","value":"Mobile Offices and Modular Buildings","isSelected":false,"price":""},{"text":"Official Proposals","value":"Official Proposals","isSelected":false,"price":""},{"text":"Safety and Security","value":"Safety and Security","isSelected":false,"price":""},{"text":"Shipping","value":"Shipping","isSelected":false,"price":""},{"text":"Technology","value":"Technology","isSelected":false,"price":""},{"text":"Telecommunications","value":"Telecommunications","isSelected":false,"price":""},{"text":"Trade Association","value":"Association","isSelected":false,"price":""}],"multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"inputMask":false,"inputMaskValue":"","salesforceMapEnabled":false,"salesforceMapObject":false,"salesforceMapField":false,"salesforceMapType":"live","enableChoiceValue":true,"formId":23,"descriptionPlacement":"below","conditionalLogic":"","displayOnly":""}],"id":23,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"cssClass":"","enableHoneypot":"","enableAnimation":"","limitEntries":"","limitEntriesCount":"","limitEntriesPeriod":"","limitEntriesMessage":"","scheduleForm":"","scheduleStart":"","scheduleStartHour":"","scheduleStartMinute":"","scheduleStartAmpm":"","scheduleEnd":"","scheduleEndHour":"","scheduleEndMinute":"","scheduleEndAmpm":"","schedulePendingMessage":"","scheduleMessage":"","requireLogin":"1","requireLoginMessage":"","enable_sisyphus":"","confirmations":[{"id":"54593e7360668","name":"Default Confirmation","isDefault":"1","type":"page","message":"","url":"","pageId":"12714","queryString":"saved=profile#eef5baea81d9a39fd","disableAutoformat":"","conditionalLogic":[]}],"notifications":[{"id":"54593e7360199","to":"{admin_email}","name":"Admin Notification","event":"form_submission","toType":"email","subject":"New submission from {form_title}","message":"{all_fields}","isActive":false}]},"version":"1.9.1.2"}
add_filter('gform_pre_render','magx_populate_section');
function magx_populate_section($form){
if(in_array($form['id'], array('23','24'))){
gra
$user = wp_get_current_user();
if(isset($user->ID)){
/* Just for you to set this up */
add_user_meta($user->ID,'section',array('Building Products','Professional Services','Construction Capabilities'),false); //the false is important - its how we store this data.
//end
$section = get_user_meta($user->ID, 'section',false);
/*
returns array that looks like this
[section] => Array
(
[0] => Building Products
[1] => Professional Services
[2] => Construction Capabilities
)
*/
if( !empty($section) && is_array($section) ){
foreach($form['fields'] as $fieldid=>&$field){
if($field['inputName'] == "section"){
foreach($field['choices'] as $choice=>&$choice_options){
if(in_array($choice_options['value'], $section)){
/*it gets to here no problem, its making the set to true last.
*/
//$form['fields'][$fieldid]['choices'][$choice]['isSelected'] = "true";
$true = true;
//$choice_options['isSelected'] = "true"; //nope
//$choice_options['isSelected'] = 1; //nope
//$choice_options['isSelected'] = true; //nope
$form['fields'][$fieldid]['choices'][$choice]['isSelected'] = $true;
wp_mail('mruth@magazinexperts.com','Test Section - '. rand(1,100),print_r($form['fields'][$fieldid]['choices'][$choice],true));
//wp_mail('mruth@magazinexperts.com','Test Section - '. rand(1,100),print_r($form,true));
return $form;
}
}
}
}
}
}
}
return $form;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment