## General developer forum

### Modform - Change amount of Input-Fields with GetParam

Modform - Change amount of Input-Fields with GetParam

Hi developers,

Im currently creating a little moodle plugin , its a question form with multiple choice checkboxes. My problem in the Modform i want to let the creator of the Activity to change the amount of Text Input Fields with the Get parameter &fields=x but when i submit the form it only sends the first field.

But, when i create the loop with a hardcoded amount of iterations it sends all fields.

Is this somehow a securty measure or what is the problem ?

Sry if it´s a stupid question but im pretty new to moodle plugin development.

Ps:In the file i appendet i tried a workaround but it wasn´t sucessfull.

Average of ratings: -
Re: Modform - Change amount of Input-Fields with GetParam

Julian "i want to let the creator of the Activity to change the amount of Text Input Fields"

I suppose you mean you want to let the creator change the number of Text input fields (not the amount of text in those fields).

I suggest you look at the way the Quiz settings form deals with adding x Feedback fields to the form. That's file moodle/mod/quiz/mod_form.php. It uses $this->repeat_elements(...). Joseph Average of ratings: Useful (1) Re: Modform - Change amount of Input-Fields with GetParam Yes that´s what i meant ( sry im not natively speaking english, hope my english isn´t to hard to read ). Back to the topic, what you suggested really was the way to go reach what i intended to do, thanks for the hint. I just initialized my optional parameter as standard$repeatno so that if i want to create 21 answers i dont need to click the add 3 more answers button 7 times.

Average of ratings: -