I would like to add a text field to all my forms programatically. There is a hook for adding hidden fields (wpcf7_form_hidden_fields) but I can not find one for regular fields. I tried modifying the form via wpcf7_form_elements which works, I get my new field. However it is not really part of the Contact Form 7 cosmos, I can not use wpcf7 validation on it.
Is there another way?
Thanks
Related
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/
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.
I have a form in an asp.net mvc view.
The form contains a textbox which is used to edit the username property of my model.
I want to add the bootstraps typeahead to this textbox searching the users while typing.
As far as I know the typeahead should post a form, but I can not put a form inside a form (since I want to use the typeaheads search result in form postback).
How can I solve it? Can it be done without using Ajax?
EDIT:
It's important that the selected username influences the content of the form. So somehow I have to post the typeahead selection, which in the server modifies the model and the result is an updated form. After that the user fills the remained fields than posts the form.
Typeahead can work on any <input type="text">, you should inspect the element in the examples. When you do you will notice that the input has a data binding called data-source which is just an array of strings. It then filters those strings whenever you type.
You could certainly populate that array via ajax. You might want to find some way to disassociate that <input> from the form though. Although it's probably not a big deal breaker.
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.
I have an infopath form, is there anyway to get this current infopath form and once submit is clicked, have it go to another form or show a different set of fields upon press [submit] ?
Thanks
If what you want to achieve is some kind of multi-step form, you could use views. InfoPath Views allow to display different fields depending on the view, and you can add buttons to navigate from one view to an other. You may also evaluate some rules before switching to an other view (for example to check for mandatory fields).