[EXTENSION] wForm Yii Composite Form Extension
#3
Posted 20 January 2012 - 08:20 AM
Nymphetamine, on 20 January 2012 - 08:12 AM, said:
Do you mean product example sources? If so, then why extension should be places into example which located INTO EXTENSION?
#4
Posted 20 January 2012 - 02:24 PM
I tried your product example, but delete images (attachment) doesnt work.
I click on delete link (jquery remove elements), but after submnit product form, images records are still there.
Any idea?
Not implemented this function yet?
Marena
#5
Posted 21 January 2012 - 07:39 AM
Marena, on 20 January 2012 - 02:24 PM, said:
I tried your product example, but delete images (attachment) doesnt work.
I click on delete link (jquery remove elements), but after submnit product form, images records are still there.
Any idea?
Not implemented this function yet?
Hi Marena,
Thanks for your reply.
You are right. Removing of related records is not working properly yet. It will be ready in the next extension version which we plan to get done during next week. BTW, there would be also cascade delete to allow remove products with all necessary relations.
Regards,
Alex
Weavora Team
#6
Posted 21 January 2012 - 09:53 AM
Weavora Team, on 21 January 2012 - 07:39 AM, said:
Thanks for your reply.
You are right. Removing of related records is not working properly yet. It will be ready in the next extension version which we plan to get done during next week. BTW, there would be also cascade delete to allow remove products with all necessary relations.
Regards,
Alex
Weavora Team
Hi Alex
Thanks again,
I'll wait for next version.
Meanwhile I'll edit javacript in existing version. Instead of js delete element, just hide it and set hidden field "deleted" to 1 (because in some tables I dont want to delete an records (for history issues), but only set to deleted)
Have a nice weekend,
Marena
#7
Posted 23 January 2012 - 07:08 AM
Just ideas for you what changes I made to satisfied my needs.
I made some changes in jquery.multiplyforms.js
1. option to choose between .appendTo / .prependTo (in some forms I prefer add new rows at the beginning)
2. I change beforeDelete callback to (I needed to just hide records in database - not delete)
// beforeDelete callback
// I know - now its replace delete
if ($.isFunction(self.options.beforeDelete)) {
self.options.beforeDelete.call(this, embedForm, self);
} else {
embedForm.remove();
}
// in form i call
beforeDelete: function(embedForm, multiplyFormInstance){
if (confirm("Are you sure to delete this record?")) {
embedForm.find('input[id$="valid"]').val(0);
embedForm.css('display','none');
} else {
return false;
}
}
Have a nice day
Marena
(sory for google translator english)
#8
Posted 23 January 2012 - 07:33 AM
Thnx for good ideas.
Quote
We'll add `appendMode` option with possible values: 'append' or 'prepend'
Quote
You are absolutely right there. That's why we should move to jquery events instead of callbacks. So finally your code will look like:
$('.hasManyRelation')
.multiplyForms({
embedClass: 'has-many-item',
templateClass: 'just-empty-form-template-hasManyRelation'
})
.on('multiplyForms.add', function(event, embedForm, multiplyFormInstance){})
.on('multiplyForms.delete', function(event, embedForm, multiplyFormInstance){
event.preventDefault(); // callback-killer feature :)
if (confirm("Are you sure to delete this record?")) {
embedForm.hide().find('input[id$="valid"]').val(0);
}
});
Also it will allow bind/unbind add/remove handlers in other places of the code.
Best regards,
Alex
#10
Posted 31 January 2012 - 04:51 AM
Change log:
- Cascade delete
- Remove old related item during update
- Multiple bug fixes
- jQuery plugin: append mode
- jQuery plugin: replace callbacks with events
#11
Posted 01 February 2012 - 03:40 PM
Did the v 0.2 manage the add/update/delete process in a transaction?
the version I downlowa few days ago seems not! am I wrong? (hope yess, because this extension will make my life easier if it do manage transactions)
#12
Posted 01 February 2012 - 03:54 PM
Boula7ya El Fertass, on 01 February 2012 - 03:40 PM, said:
Hi,
I with to say 'yes', but wForm doesn't support transactions for now. But that's a good feature for next release.
For now you could try temporal hook:
public function actionEdit($id = null) {
...
if ($yourForm->validate()) {
$transaction = Yii::app()->db->beginTransaction();
if ($yourForm->save()) {
$transaction->commit();
$this->redirect(..);
} else {
$transaction->rollback();
}
...
}
#13
Posted 02 February 2012 - 02:25 AM
I see that I am more concentrated on looking for extensions that make my life easier OutOfTheBox then traying to adapt solution to my needs, ehhmmm, maybe there is somethings to reconsidere here......
or perhaps transactions in multidependent inserts is something MusHaveOutFromTheBox.
I definitely agree with you, I think it's a good feature to have, maybe with autodetecting for transactions support in databases.
Thank you again.
Weavora Team, on 01 February 2012 - 03:54 PM, said:
I with to say 'yes', but wForm doesn't support transactions for now. But that's a good feature for next release.
For now you could try temporal hook:
public function actionEdit($id = null) {
...
if ($yourForm->validate()) {
$transaction = Yii::app()->db->beginTransaction();
if ($yourForm->save()) {
$transaction->commit();
$this->redirect(..);
} else {
$transaction->rollback();
}
...
}
#14
Posted 07 February 2012 - 01:59 PM
You have something verry interesting here to manage related models, I t hink your extension can be improved with this behavior
https://github.com/y...elated-behavior
just trying it for now, but it look awsome for me.
#15
Posted 15 February 2012 - 10:03 AM
does WUNIT support testing AJAX requests?
(or to be precise - invoking and processing javascript events?)
Example:
I have a form with 2 dropdown boxes.
When I select option in first dropdown, then ajax is invoked and populates second dropdown box.
As far as I know Selenium is the only tool capable of invoking AJAX requests.
Does WUnit somehow support this magic and can fully replace Selenium server?
Thank you.
Lubos
Greatest discoveries in 22nd century will be about the gravitation. | Homepage: http://www.synet.sk
#16
Posted 02 March 2012 - 10:57 AM
Fatal error: Call to a member function validate() on a non-object in /var/www/html/senik/app/protected/extensions/wform/WFormRelationHasOne.php on line 32
The function getRelatedModel return an array and not a model object ?
#17
Posted 05 March 2012 - 01:38 AM
Sebastien Asselin, on 02 March 2012 - 10:57 AM, said:
Fatal error: Call to a member function validate() on a non-object in /var/www/html/senik/app/protected/extensions/wform/WFormRelationHasOne.php on line 32
The function getRelatedModel return an array and not a model object ?
That's quite strange. It could only if you put not well-formatted data into HAS_ONE model. E.g. not [name => 123], but [0 => [name => 123]]
#18
Posted 07 April 2012 - 01:58 PM
I want to include js/jquery.multiplyforms.js in my layout file, but it seems not to work. Normally the js-file should automatically copied in the asset-folder, or?
In the assets-folder is no jquery-multiplyforms.js. The result is that "delete" and "add" doesn't work for me. :-(
Thx
#19
Posted 08 April 2012 - 05:22 PM
If I attach the behavior I get an error like this one: "Illegal offset type in isset or empty". Maybe there is a Problem, because the PK of one table hast two columns. But I don't know how setup this.
A short reply would help me.
After some tests: Your extension does not support a PK which hast two colums. Only the ManyManyRelation allows this. So the wform extension is not helpful for me, because I have a HasManyRelation, where the PK hast two Columns and only one of these two columns is a FK.
#20
Posted 10 April 2012 - 01:31 AM
Easy to use, and with very clear documentation and examples.
My question is in the example given here https://github.com/w...e:-Product-form
is it possible to add other information to "product_2_tag" table, suppose I want to add "product_tag_serial_no" for every entry in "product_2_tag".
I struct with this problem Please help me out.

Help














