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.
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/
I have a list of objects on my page. I need to edit an object in a popup.
There are many objects, and generating many forms for each object is not correct.
What can I do, can an iframe do in a popup?
You don't need to use iframe.
Build your form in your controller and render it in the html. The fact that it's in popup doesn't change anything. It doesn't matter if it's in popup or not, the final result will be POST call to your action.
You should have an action that renders a form, callable from an ajax in the view where you have all those entities.
Just change the entity id that will be received in the action as argument by changing the ajax url using js depending on the clicked entity you want to edit.
Then return with the ajax the form already rendered so with only one form you can edit as many entities (of the same class) as you want, without even need to render one form before they click which one they want to edit.
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 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).
I am trying to create a form that is made up of controls with values that represent an entity with multiple child entities.
The form will represent a product with multiple properties where the user will then be able to create options with multiple properties which in turn be able to create multiple option-items with multiple properties.
My question is what is the best approach? Can i use ajax to avoid postbacks and having to rewrite the controls to the page? If i dynamically add the controls in the form of table rows or grid rows will the data/control values be available in the code-behind when i submit?
This is an age old question.. the last time i had to do this was .Net 2.0, pre-ajax (for me) and i was forced to recreate all the controls on each post back. thanks!
If I'm understanding your question correctly, you want to dynamically change form elements depending on some kind of selection criteria without refreshing the page? Javascript can do this for you. If your elements rely on data from somewhere, such as options for a select menu, then yes you will have to use an ajax request to populate those. If they are static options, then pure javascript will work for you. And though the source won't indicate your generated elements, they will indeed be available for a submit. I hope this helps.