PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

HTML Being Stripped Out from HTML Block

  1. Hi,

    I am trying to build a recommendation tool using Gravity forms.

    http://hostinghq.in/tool/

    The problem is, the HTML field that gets displayed does not show the live links. Try this by simply answering "How Many Websites Will You Host in Your Account?*" with 10+.

    Also, is there any way to show the result once the user submits the form rather than using HTML tab on the same page?

    The method I am using now is using conditional fields and creating several HTML blocks. I know this is not the ideal way as I can miss out on several combinations. Can you suggest an alternative?

    P.S: I am using the latest chrome browser.

    Posted 7 years ago on Saturday February 9, 2013 | Permalink
  2. For the first issue, your HTML is invalid. As an example, this:

    <p>Recommended host: <a href="http://hostinghq.in/hostgator" rel="nofollow" target="_blank" ></a>Hostgator</p>

    Should be this:

    <p>Recommended host: <a href="http://hostinghq.in/hostgator" rel="nofollow" target="_blank" >Hostgator</a></p>

    ignore the rel="nofollow" - that is added by the forum software

    The "Hostgator" was not in the right spot, and your hyperlink was not linked to any text.

    I'm not sure what you mean with your second question. HTML blocks are designed for presentation elements in the form: the information is not captured in the entry.

    Posted 7 years ago on Saturday February 9, 2013 | Permalink
  3. My bad. I fixed the HTML issue.

    Can you say how I can get the desired functionality?

    The problem statement is this: I need to recommend a solution based on the user inputs in the form. Once they click get recommendations, they should be given the recommendation based on the inputs they gave.

    What is the best way to do this?

    Posted 7 years ago on Sunday February 10, 2013 | Permalink
  4. And in addition to showing the recommendation, you need to store that recommendation in the entry, correct?

    I think your approach is fine (showing the HTML block with conditional logic.) Add an admin only field which stores the hosting recommendation (godaddy.com, hostpapa.com, etc.) with conditional logic as well. Just use the same rules you use to show the HTML block. That way, you show the visitor their HTML recommendation with the link, and you store what you recommended to them in the entry.

    Posted 7 years ago on Sunday February 10, 2013 | Permalink
  5. I don't need to store the recommendation entry anywhere. I just need to make sure that the suggestion is shown after they click "get recommendations" and not as they do now (It immediately pops up when the condition matches)

    Why do we need the admin only field? I am not clear on this one.

    I also see that even if some recommendation matches, it does not show the recommendation.

    Posted 7 years ago on Sunday February 10, 2013 | Permalink
  6. Oh, instead of the HTML being shown on the page when they make their selection, you want to show them their option on the confirmation page? Is that correct?

    You can ignore the advice about the admin-only field if you do not need to store their recommendation.

    If you want to show different recommendations in the confirmation, based on their form selections, you can use the conditional shortcode: http://www.gravityhelp.com/documentation/page/Shortcodes#Conditional_Shortcode

    Regarding your last sentence, that will be related to how you have configured the conditional logic. Please recheck.

    Posted 7 years ago on Sunday February 10, 2013 | Permalink
  7. Thank for your help. I figured out the issue with recommendations not displaying.

    You are correct in assuming that I'd want to display these HTML blocks after the form submission- not before it.

    I took a look at the conditional shortcode page. I have a question.

    Is the below correct?

    [gravityforms action="conditional" merge_tag="{How Many Websites Will You Host in Your Account?:1}" condition="is" value="1-3"].

    Since my recommendation uses multiple conditions to make suggestions, can I club several such conditions to produce the output? If so, what is the syntax for it.

    Thanks.

    Posted 7 years ago on Monday February 11, 2013 | Permalink
  8. If the value of the selection is literally "1-3" (a string, not a range of numbers from 1 to 3) then this will work. You could also give each one of your radio buttons a value, so for your four choices, A, B, C and D, then you could use

    [gravityforms action="conditional" merge_tag="{How Many Websites Will You Host in Your Account?:1:value}" condition="is" value="A"]

    Note the addition of ":value" in there, to test for the value of the selection, not the label.

    Multiple conditions cannot be combined or nested in the conditional shortcode. If you have a complex requirement, you may have to use a function in your theme's functions.php to test all your conditions, then return the proper confirmation message. You can use the gform_confirmation filter to run your code http://www.gravityhelp.com/documentation/page/Gform_confirmation

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  9. The value is "1-3" and not a range. Glad that would work.

    I allow the user to choose only one radio button per question. So the requirement is to combine multiple merge tags and produce an output.

    So basically, I'll have to use the functions.php to create a PHP script which processes the inputs and returns a custom value. Am I correct?

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  10. I am pretty new to this whole programming thing. Can you help me out with all the hooks I need to use? Then I can maybe learn PHP as well as the hooks and create the script to process this.

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  11. Please see this response I posted this evening:
    http://www.gravityhelp.com/forums/topic/conditional-formatting-for-post-submission-forms#post-146137

    Particularly, the last two links where I describe adding code to your theme's functions.php to modify the confirmation message based on values submitted in the form.

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  12. I am looking at this code: http://pastebin.com/EJEFYPW1

    For my tool (http://hostinghq.in/tool/) I have 5 questions. So I assume, I need to have 6 variables 1 for each answer and 1 for the final recommendation.

    http://guitar.chrishajer.com/test-of-conditional-confirmation-text/ does not seem to work. The result page simply says "Thank you for your answers. Here’s what we think:" No other data. So I cant understand it properly.

    My question is, how do I combine all the logic I need? Sorry if it sounds repetitive, but I cant seem to figure out the code properly (blame my lack of PHP knowledge)

    Posted 7 years ago on Tuesday February 12, 2013 | Permalink
  13. Sorry about the broken theme/form functionality. I was testing a different theme and the theme's functions.php didn't contain the functionality I wanted to show you. Please try again:

    http://guitar.chrishajer.com/test-of-conditional-confirmation-text/

    Posted 7 years ago on Wednesday February 13, 2013 | Permalink
  14. Yes. It seems to be working now. However, these are still individual recommendations based on one set of inputs. However, in my case, I'd need various sets of inputs.

    Take the scenario in the test you gave me.

    Instead of the 3 different statements, I'd have one statement which will be based on the analysis of all 3 inputs. How can I combine all 3 logic and produce a single recommendation?

    Posted 7 years ago on Wednesday February 13, 2013 | Permalink
  15. In this code: http://pastebin.com/EJEFYPW1 you will need to create your own logic and tests to determine what shows for a confirmation. Your application is a custom one, but it is not difficult PHP to set up and insert into that code. You'll just replace the tests that are there with your own tests.

    Posted 7 years ago on Monday February 18, 2013 | Permalink