2

I am trying to load a array of form fields as below.

grade.xml

<field  name="gralev_code[]" 
  type="text" 
  class="width20"
  label="JSCH_GRALEV_CODE"
/>

default.php

$this->form->getInput('gralev_code[]')
$this->form->getInput('gralev_code[]')
$this->form->getInput('gralev_code[]')

The above shows 3 text fields in the form however the values are not received in the model.

Not sure whether this is achievable or not?

4

I manged to get a solution as below.

<field  name="gralev_code][]" 
  type="text" 
  class="width20"
  label="JSCH_GRALEV_CODE"
/>

in model.php

$formdata = $this->_jinput->get('jform', '', 'array');
$vals = $formdata['gralev_code'];
  • On Joomla 3.4.5 you have to write name="gralev_code][" . – Laoneo Nov 12 '15 at 14:38
  • @Laoneo I have tried this, but it doesn't save the plugin's params. – Anriëtte Myburgh May 11 '16 at 11:55
0

You can use wrapper, unfortunately you can't fill non unique array keys. Then catch data by "fields" name ...->input->get('jform')

$jform['keyname']['a1']

<fields name="keyname"> 
    <field  name="gralev_code[a1]" 
        type="text" 
        label="JSCH_GRALEV_CODE"/>
 <fields>
  • Please do your best to use proper English (you instead of u), format your inline code expressions by wrapping in backticks, and try to keep code indentation to a minimum for less horizontal scrolling. When you produce excellent posts, then no one needs to touch your work to bring up the quality of the delivery. – mickmackusa Oct 1 '18 at 22:56

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.