1

I am trying to assign value to unlimited field group on load of content using form alter hook. Value get assign successfully for all rows. But when form get loaded it display only one row. On click of "Add Another Item", it display second row with value assigned in form alter hook. enter image description here enter image description here

Is there any way to display number of rows as required? Can I handle this in form alter hook?

1

Yes you can do it by form_alter. Seeing through the code of other similar question, I see that unsetting the Add More button can do it for. You can review that code & apply for your case.

You can do it by help of Field Validation module too, which has been mentioned in 2nd answer & more feasible way. I have also used it for some projects of mine, where I did set minimum & maximum required for a field accepting multiple values.

| improve this answer | |
  • Hi thanks a lot your form alter hook solved my one issue. But when I try to save it, it store value for only one row. Don't know why. – Sudha Bisht Sep 16 '16 at 5:54

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.