Contact form 7 file field related query - wordpress

We have required conditional file field that depends on another dropdown field. If dropdown field value YES then file field will show and added required option but if dropdown value NO then file field not show and remove the required option.
We have done the hide show logic in file field but not able to do required option on off. Can anyone please suggest how to do that?

Without the exact website link, it is difficult to explain perfectly. However, from what I understand what you need to do here is to implement a custom validation.
You can refer this link to understand how to implement custom validation.
Basic flow of code:
1. Give ID to the drop down so that you can bind an onchange event with it
2. Bind an onchange event that hide/show the file field
3. Create custom required validation which checks your drop down value and decides whether the other field is required or not
This should do your job... Feel free to ask other questions and post your website uRL and code to get a better answer.

Related

Make Gravity Forms Hidden Field Required?

I have a Wordpress site that uses Gravity Forms, including hidden fields which are required for proper functionality. Is there a way to make hidden fields on forms built with gravity forms required?
I will be sending out an email with a URL linking to this form which auto-populates these hidden fields. However, I'd like to make these hidden fields required, or prevent the form being submitted if these hidden fields are not set, which may happen if a user navigates to the form manually instead of navigating to it via a generated URL.
I wish to avoid the perception that the form has been submitted when it has only been submitted with partial information.
The simplest, code-free solution would be to use conditional logic to only show the submit button if your hidden fields are not empty. Here's what the settings might look like:
You can take this a step further and use the opposite conditional logic to show an HTML field with a custom message letting the user know why they can't submit the form.
a hidden form element can't be required.
elements of type hidden let web developers include data that cannot be seen or modified by users when a form is submitted.
Source
If you put a hidden value, make sure you put it with a value to be sent or make sure that before submit, via javascript you edit that value.
You can now use two CSS classes to hide your field:
"gf_hidden" or "gf_invisible"
It won't show the Validation Message if it isn't filled though, so the user may not know what is missing from the submission:
The folk at Gravity Perks have a nice page explaining it in more detail though.
https://gravitywiz.com/how-to-hide-gravity-forms-product-fields/

spring-mvc: submitting a form when a checkbox is checked

Is there a way to submit a form when a checkbox is checked in Spring MVC?
Basically I have a bunch of input box that belongs to a particular form and there is a submit button which generate run an sql and display on the same page the result. I have a checkbox to generate the result in a dowloadable excel file. When I submit the checkbox it should do a submission but a different url than the form above it?
Any help or hint will be greatly appreciated it or an url how this can be done!!
I google on the internet but couldn't find an answer to my question.
This is a use-case for the params attribute: define 2 methods in controller with different params. As a value of the params, use the name and the value of the checkbox input.
Documentation: https://docs.spring.io/spring/docs/4.3.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping-params-and-headers

Open a new Gravity Form upon form validation error

I am looking for the best/easiest way to open/start a new gravity form when the current form fails validation. Example: user enters a zip code that is not valid upon submission. When the form fails validation a second form opens which is used to gather user contact info so they can be notified when their zip code is available.
Does anyone have an answer already to this that I was unable to find in the search or have any ideas as to a solution?
Thanks in advance.
You would have to tap into the action "gform_after_submission" and do a redirect to another page with that form. http://www.gravityhelp.com/documentation/page/Gform_after_submission
Another option would be to provide a drop down list of all the available zip codes with an additional option, like "mine is not in list". Then have some other fields that have conditional logic to only show if the "mine is not in list" value is selected.
http://www.gravityhelp.com/documentation/page/Form_Settings ( look for the conditional logic section)
Hope that helps.

Conditional field using dynamic vocabularies to custom fields on ##register

I'm following collective.examples.userdata to add some custom fields on the register form.
I want to add two fields, one for state and another for city, where the second load content based on the previously selected state.
My question is how it is possible, can do this only with the schema, using dynamic vocabularies or is need to edit registration form? How can I do it?
Another issue is how to load the registration form in a portlet. Is Possible fill the ##register viewlet?
Thanks!
Use javascript to do the dynamic part of the secondary field. To render the form inside a portlet, there are a couple of ways to do it but again, using javascript might be the easiest. You have place a register button that opens a registration overlay.
Take a look at http://plone.org/products/plone.app.jquerytools for how to wire it up.

Advanced Search Form Validation in asp.net

I'm looking to make validation for a page in which one or more fields have a value in them. I have an advanced search form in asp.net and I'm trying to pop up an error and not post back if all the fields are empty. I've looked into required fields validators but I'm not sure how to make them work together in a AND type fashion instead of the OR fashion that a validation group of required field validators would imply. I hope this makes sense. Thanks for the help.
i had to do something similar years ago and i was using 1.1 then.
what we ended up doing was creating required field validators but disabling them.
then onload we would loop through the validator dictionary, enable them and check if they passed. if any of them passed we broke off the loop and we continued execution, otherwise, if all of them failed then we displayed a warning. Unfortunately, this would require a postback.
If you want to accomplish this on the client-side then you could write a simple javascript function to take care of it before postback.
for every control, place an onBlur event. javascript will check if there is a value in the field and maintain a flag. then before submission you would check the flag and either allow submission or show warning.
You could just write the javascript validation function yourself to handle this case and attach it to your search button.

Resources