0

I am building a form using the FAPI and so far it is going fine.

I do however have a requirement for two tightly coupled values (currency and amount) that I wish to appear side by side in the form and not on separate lines.

What I need is something very similar to the way Drupal handles dates (3 inputs side by side, Im not sure, but are their input values added together to produce one value?)

Im sure this is possible using the FAPI but I cant see how off hand.

I would like to avoid any extra modules if possible.

Any takers?

thanks

Kevin

1

You can groupe the two fields into a field group. This gives HTML code wrapped around the fields. Just change the CSS settings of this HTML to your needs.

  • Are you referring to the field group module? aside from the fact that I didnt want to add a new module, it appears this is not available for Drupal 6 – Kevin Bradshaw Jul 5 '12 at 8:18
  • 1
    Field groups are a standard feature of CCK in D6 you just have to activate the module. For D7 it's an additional module. – BetaRide Jul 5 '12 at 8:20
  • Actually, I accepted this answer, but it was not at all what I was after. I could create custom fields no problem, but I could not insert them into my FAPI. I found a much more appropriate solution: akchauhan.com/create-drupal-form-elements-like-date-element – Kevin Bradshaw Jul 6 '12 at 9:23
0

In Drupal 7, you can use the Double Field module. It even allows for prefixes and suffixes for text fields, which work great for currency fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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