I use fabrik for my project. In my website there is many forms that have same fields like national code. So I want to add an element like national code to many groups instead of one group. I don't know what to do this and any helps will be appreciated.
Once created, you could simply copy the element from a group to others. But it's not effective if there is a lot of groups and if you need to change the element regularly.
This problem bring us to create you own Fabrik form element. As I know, Fabrik doesn't propose an easy way to create a custom element type.
Before developing your own element, you can look in Fabrik Elements plug-ins if a generic element could be suitable. Otherwise, you can copy the code of an existing similar plugin and customize it yourself.
You can also check in Fabrik blog if in the future a feature of "Custom Elements" is planned
Related
I am building a web application in php (actually cakephp), HTML5, & Jquery.
In one page I have a form which will make too many calculations. In it there is a form with maybe 30 input fields. These fields are related to each other with formulas.
Whenever a field value changes, I want to update all others. How to achieve this?
Note: if there is some SDK which will help me in this, it will be better.
Update 1
I will make a short example: it is about designing some industrial product, let us call it a cabinet.
A cabinet consists of too many items, and these depend mainly on: Width/Height/Depth + some additional characteristics (around 5). I need to calculate the specs of the components which constitute a cabinet. There are maybe 15 components. each component has a specific formula, and may depend on all mentioned inputs. If I change the width, many of the components specs should automatically update.
The general idea is, you need to use a generic selector:
$(".my_inputs")
Add an 'on()' EventHandler:
$(".my_inputs").on('change', function() { }
Then, within it, do whatever type of data manipulation you want:
$(".my_inputs").on('change', function() {
// use jquery to repeat through all .my_inputs and alter their data
// or set all .my_inputs to a specific value
// or do anything else you want
}
Now that you have the general idea, look through the jQuery API to find details on however you'd like to manipulate the data (or just use good ole' Javascript! :)
It is still a JS solution. Give each of the input boxes a class name (e.g. "myClass"), then you can do this:
$('#myInputfield').keyup(function(){
$('.myClass').each(function(index){
$(this).val($('#myInputfield').val());
});
});
NOTE: You need JQuery to achieve this and it is assuming you are looking for changes in just one textbox (i.e. textbox with ID:myInputfield). The main textbox should not have the same class.
I am working on php and now trying to learning Zend, I am trying to collect the age (Year/month) using zend_form. So I want to put 2 text boxes in the same DD wrapper.
Can any one help me please.
Thank you
You could create a composite form element that comprises your two text fields. Then create custom decorator for that element to handle the aggregation. Then add the standard DtDd wrapper.
See this post by MWOP for an example: Creating composite elements
You can't place many input boxes in single element's decorator (with some exceptions like radioboxes or multicheckboxes). Instead that, you must to remove decorator Zend_Form_Decorator_DtDdWrapper from both elements and place them in new Zend_Form_DisplayGroup. Then You can set Zend_Form_Decorator_DtDdWrapper to that DisplayGroup
I have two nodes, one is kind of a parent to the other node. For example, I'm displaying information about Plants. There are two nodes, Plant_Parent which has the latin name and some common names which is moderated, and then there is the Plant_Info which is not moderated and it has information like bloom time, growing experience, water requirements, stuff that's user specific. However, I want to be able to display the two together, i.e. someone selects a Plant_Parent node, and all the plant_info nodes are display as well.
Drupal doesn't seem to support this, is there a why I can do this?
The heavily-used CCK module has a Node Reference field type that's perfect for this.
Node reference as ceejayoz says can do two nodes displayed together. However you could also just have different permissions on fields within a node. Have a look at content_permissions which is part of CCK, or look at the sparsely documented hook_field_access() if you wish to have even more custom permissions.
What is the best way of implementing multi-level lists/bullets in php?
What I'm trying to implement is a system to take in short phrases, and categorize them within sections. However, at the same time, I would like to have each section to be collapsible and capable of having sub-sections within them.
For Example:
Section 10
Section 10.X
Section 10.X.X
I was thinking of having each sub-layer as an array, but I realize that I've seen the same type of collapsibility in many places, and they all seem to be similar. Maybe there already is a package or library that does this? And if there is, how should my data-structure for keeping each entry be structured?
Your bullets are being done in HTML, as PHP merely generates HTML code. Consider using nested <ul> tags.
The collapsing is most probably going to be javasscript. (Although I wonder if the CSS :active psuedoclass would work in supportive browsers...)
Regarding the package, I'm not sure. You essentially need a recursive list generating function.
For the kind of structure you mentioned, i think you need what is know as Tree View. Check it out on how to implement that.
Screenshot:
Anything to do with toggling, display lists, indenting etc should be achieved relatively easily with HTML/CSS/Javascript.
Inside your category table, you could create a parent_id field which matches to your primary ID. Then run loops to display your TLD as well as another loop to display the categories within the parent.
My view holds a list of nodes ranked by rating (vote-API/Fivestar).
I wish user to hide nodes they do not wish to see in this view. Can this be done?
I'd use flag module. Users flag content (nodes), then you hide it using view filters.
If you want to be really lazy (and future-proof), use taxonomy.
Create a vocabulary called "Visible" and add a "No" term.
Then filter out all the nodes tagged with Visible/No with views.
Always better to use plain language with newb users anyway.
Is it completely arbitrary which nodes they don't want to see? Like they just want to hide an single node they already read on don't care about? If so then there is no easy way that I know of. That would require some sort of custom module that I've never come across.
If it is more predictable and consistent like the user wanting to change the view to only show nodes that are rated 3 or above or 4 or above then you can do that by creating a filter for and exposing it.
Hope that helps.