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.

form validation time field

  1. I added special form validation to check begin and end times entered for a date to make sure they are allowed for that day of the week and don't exceed a 3 hour block of time. My code can be found here:

    http://www.pastie.org/4075016

    The validation is working to take the person back to the form and displays a message indicating a problem with the submission and errors are highlighted below. But there are no fields highlighted below in the form. It should have either the begin time or end time highlighted. If you look at my code (e.g. line 18 or 24 for checking field id and assignment of error within that if statement) I'm thinking that I somehow need to specify the individual field elements for each time field to get them flagged as invalid. How do I reference those field elements in the validation's form field object? I thought maybe I would find that in the documentation. But when I searched on field object I found this page which doesn't even list the time advanced field:

    http://www.gravityhelp.com/documentation/page/Field_Object

    Thanks for your help,
    Jack

    Posted 11 years ago on Tuesday June 12, 2012 | Permalink
  2. You can view the form to see the issue I'm having:

    http://preview.lib.virginia.edu/services/graduate-student-conference-room/

    If you agree to the terms and go the second page, then you can select a date and times that are not allowed for that day of the week. When you submit the form, my validation will work. You get returned to the form but the time fields are not highlighted as the error message indicates.

    Posted 11 years ago on Sunday June 17, 2012 | Permalink
  3. The URL above is no long valid for checking this issue. Sorry about that.

    Posted 11 years ago on Friday June 22, 2012 | Permalink
  4. I never did get any response about how to get the time fields to highlight or what I might be doing wrong in my code. Has anyone done custom validation with time fields that might provide some insight on how I can get the fields to highlight when validation fails?

    Thanks.

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  5. Do you have a current URL where we can check this,? We'll need to see the field IDs to help you highlight the right ones. Thank you.

    Posted 11 years ago on Wednesday October 24, 2012 | Permalink
  6. This is the location of the form on a test server which should be accessible outside of the institution:

    https://wwwtest.library.virginia.edu/services/graduate-conference-room/request/

    However, I believe you will not be able to access it because of authentication restrictions. So give me a couple of days to get my system administrator to open up access to the form for you to be able to see it.

    Thanks!

    Posted 11 years ago on Sunday November 4, 2012 | Permalink
  7. Access to the URL in the previous post should work now without having to enter a user id and password. You can see the problem I'm having by selecting a time range that is in the morning when the room is not available to grad students. The validation appears to work and not allow the form to be submitted. But the time fields do not get highlighted. I appreciate any help on figuring out what I'm missing.

    Thanks,
    Jack

    Posted 11 years ago on Monday November 5, 2012 | Permalink
  8. This is just a reminder that I had authentication restriction removed from this form so you could look at it. My systems administrator doesn't want this left open too long. If you could get a chance to look at the issue with highlighting the time field I would appreciate it. Thanks.

    Posted 11 years ago on Monday November 12, 2012 | Permalink
  9. Is it possible for you to update both WordPress and Gravity Forms? It looks like you're using an older version of jQuery and Gravity Forms at least. Several fixes were implemented in later versions regarding highlighting validation errors and I want to make sure the code you're using is current. I understand in your environment you might not be able to upgrade with rigorous testing, but if you can upgrade, we can at least test with the very latest versions.

    However, all that aside, it looks like the hours are 13_1 and the minutes are 13_2 (for line 18 of your code) and 14_1 and 14_2 for line 24 of your code. If you look at the source of the page, you will see the ids for the individual ids in your time elements. (13_3 and 14_3 are the am/pm drop downs.)

    Posted 11 years ago on Tuesday November 13, 2012 | Permalink
  10. I updated the GF plugin on a development server behind our firewall and then modified my code like such...

    if (($field['id'] == '13_1') or ($field['id'] == '13_2') or ($field['id'] == '13_3')) {
    	$field['failed_validation'] = true;
    	$field['validation_message'] = $result['message']['begin_time'];
    }

    But this still does not highlight the time fields or display the appropriate begin time validatoin message. I just get the general validation error that indicates to see the highlighted items below with nothing highlighted below in the form.

    Since it looks like we are going to move this particular room scheduling form to another system, I am not going to spend any more time trying to resolve this issue. Thanks for the help.

    Posted 11 years ago on Thursday November 15, 2012 | Permalink
  11. Sorry we could not work it out. If you need more help, please open a new topic.

    Posted 11 years ago on Saturday November 17, 2012 | Permalink

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