This is the topic for wForm extension.
If you have questions or found a bug let me know.
This is the topic for wForm extension.
If you have questions or found a bug let me know.
WHY THE EXAMPLE DO NOT HAVE BEHAVIOR?
Do you mean product example sources? If so, then why extension should be places into example which located INTO EXTENSION?
Hi, Thanks for nice extension.
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
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
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
Hi Alex,
Just ideas for you what changes I made to satisfied my needs.
I made some changes in jquery.multiplyforms.js
option to choose between .appendTo / .prependTo (in some forms I prefer add new rows at the beginning)
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)
Hi Marena,
Thnx for good ideas.
We’ll add appendMode
option with possible values: ‘append’ or ‘prepend’
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 <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' />
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
Thanks for reply Alex and good luck with new version.
Version 0.2 released
Change log:
Cascade delete
Remove old related item during update
Multiple bug fixes
jQuery plugin: append mode
jQuery plugin: replace callbacks with events
Hi, Thank you for this nice extension
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)
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();
}
...
}
Hi,
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, [sup]ehhmmm, maybe there is somethings to reconsidere here…[/sup]
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.
Hi,
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.
Hello,
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
A try it, my input look nice. But when I want to save, I have this error.
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]]
I tried out.
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
Is "attaching behavior" necessary ?
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.
Thanks a lot WeaVora Team, for this grate extension.
Easy to use, and with very clear documentation and examples.
My question is in the example given here https://github.com/weavora/wform/wiki/Example:-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.