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.

Pre-populating fields

  1. takemura
    Member

    I have a custom field which is used to contain URLs and in setting up a post form, I have designated the custom field for the URL and in the 'advanced' tab I pre-populated it with 'http://' - I then made this a required field.

    But when testing the form to see how it plays when mandatory fields are not filled out, the error highlighting is not marking the website field as being a problem, obviously because by pre-populating it with content, i.e. http:// it has been filled out!

    The easiest solution would be for me to drop the pre-population data, or use the website option in the advanced fields which has the http:// as default and is highlighted as an error if not filled in, but this isn't going to populate my custom field which is set up to contain a URL.

    I feel this is a bug because if you have the option to pre-populate a field with data it should also flag up as an error if the user hasn't filled it in.

    Posted 14 years ago on Tuesday October 6, 2009 | Permalink
  2. If a field is required and it has data in it, it will validate. The validation checks to see that data exists in the field.

    Pre-populating a field just pre-populates that data, hence it will validate if you are validating to see if data exists.

    This isn't a bug, this is common form validation functionality.

    We can see how we can handle this in the future, but right now it is working as intended.

    Posted 14 years ago on Tuesday October 6, 2009 | Permalink
  3. takemura
    Member

    Yes, I understand it will validate because data exists. The data exists because I pre-populated it myself which is not the same thing as validating what the end user has inputted.

    Your website field option is pre-populated with http:// and it throws an error if it's mandatory and I don't fill it in.

    My custom field called website is pre-populated with http:// yet it doesn't throw an error if not filled in.

    The whole point of having the user submit their URL into my custom field is so that I don't have to do it, otherwise what is the point?

    So, what I now have to do is scrap the http:// pre-population of my custom field and write a message saying: remember to add the http://

    Not ideal.

    Posted 14 years ago on Tuesday October 6, 2009 | Permalink
  4. The Website field validates correctly because that is what it was designed to do. Otherwise we wouldn't have added a Website field and people could have relied on a standard text input. But it required specialized validation, so that is why it is an advanced field.

    I understand how you want to use the field, and understand your frustration but as you know it simply doesn't work that way right now. Unfortunately we can't rush out a change without thinking it through, implementing it the right way and making it part of our product development life cycle.

    We do plan on enhancing the custom field capabilities so it is configurable and allows you to use drop downs, checkboxes, radio buttons, textareas, etc. I will be sure to include a website address as an option when we do this.

    It will not be in the 1.2 release as development on that is complete and it is in the beta testing stage, but we plan on implementing it in the release after that.

    Posted 14 years ago on Wednesday October 7, 2009 | Permalink
  5. takemura
    Member

    Carl, you are allowing us to pre-populate field data AND make it a required field but it passes the validation process without the end user filling in the field. How can that not be a bug?

    Posted 14 years ago on Wednesday October 7, 2009 | Permalink
  6. Sorry to jump in here, just offering my thoughts since I'm experiencing a similar situation.

    I don't really see this issue as a bug, rather as a feature that hasn't been implemented into a plugin that is still in its infancy. Each form field type - name, e-mail, website, et al - validates correctly. However, there still needs to be some sort of validation for the standard text field, since the entry passes through submission if the default value or pre-populated value is still there.

    Posted 14 years ago on Wednesday October 7, 2009 | Permalink
  7. takemura
    Member

    Yeah, perhaps not a bug per se, but ill thought out in my opinion

    Posted 14 years ago on Wednesday October 7, 2009 | Permalink
  8. agelfand
    Member

    I am having a problem with the website data type, which I am using to populate custom fields in a post being generated by the form.

    If the user does not enter anything into the field, the pre-populated "http://" is still passed into the custom field to which I've assigned it. The point is for the custom field to be blank if the user does not have a website address to enter. So even if you don't want to call it a bug, it's still not working the way one should expect. If there's a website data field, and it doesn't get filled in, then the value should be empty. So please fix this feature in your next release.

    Posted 14 years ago on Monday March 22, 2010 | Permalink
  9. It should be empty. We will look into this and see what is going on. Thanks!

    Posted 14 years ago on Tuesday March 23, 2010 | Permalink
  10. If you click on a text field it disappears. However, when you click out it does not return.
    How do we configure this? Couldn't the same concept work for the http:// aspect that it prepopulates and then disappears once it is clicked on?

    How do we adjust the javascript for this or settings? Thank you.

    Posted 13 years ago on Monday November 22, 2010 | Permalink
  11. @c9labs I'm not sure what this is in reference to. Gravity Forms doesn't have any onfocus Javascript functionality built in. There is no javascript related to text fields. If you have fields where text is appearing and when you click out it does not return then this is either a customization you have implemented or some other code (theme or plugin) that is causing this behavior.

    If this regarding how to do onfocus pre-population with values that clear when you click on the field... this is a customization. You can read how to do this here:

    http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/

    Posted 13 years ago on Tuesday November 23, 2010 | Permalink
  12. Phil
    Member

    Here's a potential workaround. In using this approach, you do not pre-populate the website field, but if the user omits a protocol (http://, https://, ftp:// etc.), this code will prepend the value with http:// before Gravity Forms validates the website field.

    Posted 11 years ago on Monday March 4, 2013 | Permalink
  13. Thank you Phil.

    Posted 11 years ago on Wednesday March 6, 2013 | Permalink

This topic has been resolved and has been closed to new replies.