[EXTENSION] multimodelform/jqrelcopy Solutions for clientside cloning
#201
Posted 21 November 2012 - 04:13 AM
@Paul_Kish
#202
Posted 18 December 2012 - 08:48 AM
i need dropdownlist for a boolean field (as checkbox doesn't work) in multimodelform, the field is correctly saved but when i open my form it always show the first value even if it's the second in database.
$relStudentSemesterFormConfig = array(
'elements'=>array(
...
'ind_info_autoformation'=>array(
'type'=>'dropdownlist',
'items'=>array( 1 => 'Oui', 0 => 'Non'),
'ajax'=>array(
'type'=>'POST',
'dataType'=>'json',
'data'=>array('ind_info_autoformation'=>'js:this.value'),
'url'=>CController::createUrl('student/verifFinAutoformation'),
'success' => 'function(data)
{
$("'.$remarque.'").val(data.remarque);
}'
),
...
Have you got an idea?
Thanks
#203
Posted 18 December 2012 - 08:52 AM
A single checkbox doesn't work, but you can use a Checkboxlist with one item instead.
See Howto checkboxes
#204
Posted 18 December 2012 - 09:16 AM
i tried checkboxlist but i have also problems with it, the choice is never selected for instance.
Joblo, on 18 December 2012 - 08:52 AM, said:
A single checkbox doesn't work, but you can use a Checkboxlist with one item instead.
See Howto checkboxes
#205
Posted 04 January 2013 - 05:26 AM
yep, thanks, great extension.
I've been using it and it surely does the job. But in my new app, I have a related model with a composite Primary Key. Current MMF version wasn't working for me, so I've downloaded and tried the "Elix patch", that uses an older version of jquery-relcopy though (3.3 vs. 4.0).
With the patch, my compositePK-model is shown but: adding a new clone doesn't work, remove does but the element you just removed gets added again if you then add, if you save after removing an element CDbCommandBuilder raises an Exception for an undefined offset while checking columns' raw names.
So, my questions are:
- do you have an alternative/better solution for composite PK models, apart from redesigning tables to use a simple PK?
- (hopeless) do you have any experience with the above patch? Elix, are you reading this? Could you provide any additional experience regarding your patch?
TIA,
rash*
#206
Posted 10 January 2013 - 11:58 AM
how can i manage it?
#207
Posted 10 January 2013 - 07:01 PM
First of all, thanks for this great extension.
There is a way to make an nested MultimodelForm?
#208
Posted 18 January 2013 - 01:36 PM
Could you add support for Foundation 3 styles (like you did for Bootstrap)?
Could you also add option for change rendering class (default is MultiModelRenderForm) to configuration file? Now if i want to extend it i need to extend also MultiModelForm class and override some methods like renderTableBegin (or change extension code - bad idea...).
#209
Posted 20 January 2013 - 01:25 PM
- added support for composite pk -> rashmani, lilli
- new property 'renderForm' allows a custom 'MultiModelRenderForm' -> luk1999
- changed update behavior: loads the record from the db by findByPK before update (like default behavior of actionUpdate in a controller)
For those who want help me: mmf on github
luk1999: sorry, have no time to look at foundation3.
But if you take a look at the bootstrap mmf-code, should be possible to support foundation too.
You can make a pull request on github, if you have added foundation support.
zetsubo: sorry, have no time to experiment with nested multimodelforms. please try yourself.
#210
Posted 21 January 2013 - 06:05 AM
Could you also add params for add button? Something like this:
class MultiModelForm {
/**
* The htmlOptions for the add link
*
* @var array $addHtmlOptions
*/
public $addHtmlOptions = array();
}
class MultiModelRenderForm
{
/**
* Get the add item link or button
*
* @return string
*/
public function getAddLink()
{
if ($this->parentWidget->addItemAsButton)
{
echo CHtml::htmlButton(
$this->parentWidget->addItemText,
array_merge(
$this->parentWidget->addHtmlOptions,
array(
'id' => $this->parentWidget->id,
'rel' => '.' . $this->parentWidget->getCopyClass()
)
)
);
} else
{
return CHtml::tag('a',
array_merge(
$this->parentWidget->addHtmlOptions,
array(
'id' => $this->parentWidget->id,
'href' => '#',
'rel' => '.' . $this->parentWidget->getCopyClass()
)
),
$this->parentWidget->addItemText
);
}
}
}
With these modifications using your extension with Foundation should be pretty easy. I'll write how to do this later.
#211
Posted 06 February 2013 - 02:37 AM
#212
Posted 08 February 2013 - 06:15 AM
No need for special bootstrap in the formbuilder for the multimodelform.
See: bootstrap support
For other purposes: Yiibooster supports formbuilder.
#213
Posted 08 February 2013 - 10:53 AM
Great extension, I am very close to make it work 100% for me.
I have been struggling with the checkboxlist. I already made it work when adding a single record, but with multiple new records, it doesnt record the checkboxes as it should.
All the other fields save just fine, the checkbox is the only one giving me trouble.
Heres what I try to save.
mmf_checkbox_before.png (6.54K)
Number of downloads: 16
Heres what it shows after saving
mmf_checkbox_after.png (7.31K)
Number of downloads: 19
Any ideas?
Thank you very much.
Enrique.
#215
Posted 08 February 2013 - 11:34 AM
'ostenta_tenencia' => array(
'type' => 'checkboxlist',
'items' => array('1' => ' '),
)I put a blank space there, but I tried with a word there and same error.
Making further testing. The error is only when first creating additional rows. If I edit the checkboxes within the records already saved, everything works just fine.
#216
Posted 08 February 2013 - 11:36 AM
I need something, where to reproduce this error.
#218
Posted 09 February 2013 - 06:37 AM
Maybe an issue with the PHP version or Linux/Win ??
Changed in demo:
$memberFormConfig = array(
...
'flags'=>array(
'type'=>'checkboxlist',
'items'=>array('1'=>'Founder'),
),
...
)
Tested with 'tableView'=>true and false - all fine.
PHP version 5.3.6 on Windows 7 (XAMPP Installation).
nakarin had the 'Array to string conversion' on WAMPP too. What was the problem? How did he solve it?
In which php-file / line does the error happen?
#219
Posted 10 February 2013 - 10:07 PM
Joblo, on 09 February 2013 - 06:37 AM, said:
Maybe an issue with the PHP version or Linux/Win ??
Changed in demo:
$memberFormConfig = array(
...
'flags'=>array(
'type'=>'checkboxlist',
'items'=>array('1'=>'Founder'),
),
...
)
Tested with 'tableView'=>true and false - all fine.
PHP version 5.3.6 on Windows 7 (XAMPP Installation).
nakarin had the 'Array to string conversion' on WAMPP too. What was the problem? How did he solve it?
In which php-file / line does the error happen?
I think the problem is WAMPP wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24-32bit/Windows 7 ,so I changed to xampp-win32-1.7.4-VC6-installer/Windows 7 and the problem 's gone.Thanks for your great extension,Cheers.
#220
Posted 12 February 2013 - 08:19 AM
Thanks

Help

















