0

Lets say I have a checkboxes field and when I check one of the options, I would like a textfield to appear so I can assign a number (quantity) to it. Every option I check would have its own textfield.

For example, I have a "Fruits" field and I want to be able to say how many of each fruit I have. So it would be something like that:

[x] Apple (3)
[] Grape
[x] Orange (2)

Is there any module that does something similar to that?

Edit:

Another thing that would do the work for me would be a select list of numbers for each option. So by default the options are like that:

[0] Apple
[0] Grape
[0] Orange

So I can simply change the number of fruits in each option by selecting in the dropdown.

1 Answer 1

0

The conditional fields module should be suitable for this

Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition.

5
  • Well, I don't think it will work if I have a variable number of options and I want to have a field assigned to each one of the checked options. That would work if I wanted a single textfield (or a defined number of fields) to appear when I check any option. Please correct me if I'm wrong.
    – vitorsdcs
    Commented Jul 29, 2013 at 13:44
  • You said about variable number of options but each of these options have a name (Apple, Grape, Orange and so on). By which way you want to assign this names?
    – ya.teck
    Commented Jul 29, 2013 at 14:05
  • These options are actually nodes and I use a view for filtering them. So any time I add/delete a node, the number of options will change. That's why I can't create a defined number of fields and trigger each one of them when a option is checked.
    – vitorsdcs
    Commented Jul 29, 2013 at 14:14
  • How do you implement connection between nodes and Fruit field(s)?
    – ya.teck
    Commented Jul 29, 2013 at 15:00
  • This is just an example, but each fruit in this case is a node... and the title is the fruit name
    – vitorsdcs
    Commented Jul 29, 2013 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.