Yii Framework Forum: [EXTENSION] wForm - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] wForm Yii Composite Form Extension Rate Topic: ***** 2 Votes

#1 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 18 January 2012 - 08:23 AM

This is the topic for wForm extension.

If you have questions or found a bug let me know.
0

#2 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 20 January 2012 - 08:12 AM

WHY THE EXAMPLE DO NOT HAVE BEHAVIOR?
0

#3 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 20 January 2012 - 08:20 AM

View PostNymphetamine, on 20 January 2012 - 08:12 AM, said:

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?
0

#4 User is offline   Marena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 11

Posted 20 January 2012 - 02:24 PM

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
0

#5 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 21 January 2012 - 07:39 AM

View PostMarena, on 20 January 2012 - 02:24 PM, said:

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?


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
0

#6 User is offline   Marena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 11

Posted 21 January 2012 - 09:53 AM

View PostWeavora Team, on 21 January 2012 - 07:39 AM, said:

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
0

#7 User is offline   Marena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 11

Posted 23 January 2012 - 07:08 AM

Hi Alex,

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)
0

#8 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 23 January 2012 - 07:33 AM

Hi Marena,

Thnx for good ideas.

Quote

1. option to choose between .appendTo / .prependTo


We'll add `appendMode` option with possible values: 'append' or 'prepend'

Quote

2. I change beforeDelete callback to (I needed to just hide records in database - not delete)


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
0

#9 User is offline   Marena 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 09-August 11

Posted 23 January 2012 - 11:15 AM

Thanks for reply Alex and good luck with new version.
0

#10 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 31 January 2012 - 04:51 AM

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

0

#11 User is offline   Boula7ya El Fertass 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 27-January 11
  • Location:Algiers, Algeria

Posted 01 February 2012 - 03:40 PM

Hi, Thank you for this nice extension O0

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)
0

#12 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 01 February 2012 - 03:54 PM

View PostBoula7ya El Fertass, on 01 February 2012 - 03:40 PM, said:

Did the v 0.2 manage the add/update/delete process in a transaction?


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();
    }
  ...
}

0

#13 User is offline   Boula7ya El Fertass 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 27-January 11
  • Location:Algiers, Algeria

Posted 02 February 2012 - 02:25 AM

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, 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.


View PostWeavora Team, on 01 February 2012 - 03:54 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();
    }
  ...
}


0

#14 User is offline   Boula7ya El Fertass 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 27-January 11
  • Location:Algiers, Algeria

Posted 07 February 2012 - 01:59 PM

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.
0

#15 User is offline   lubosdz 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 115
  • Joined: 25-July 10
  • Location:Slovakia, Bratislava

Posted 15 February 2012 - 10:03 AM

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
Yii extension: Captcha Extended

Greatest discoveries in 22nd century will be about the gravitation. | http://www.synet.sk | http://ipdf.sk
0

#16 User is offline   Sebastien Asselin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 19-October 11

Posted 02 March 2012 - 10:57 AM

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 ?
0

#17 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 05 March 2012 - 01:38 AM

View PostSebastien Asselin, on 02 March 2012 - 10:57 AM, said:

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]]
0

#18 User is offline   zebra 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 04-March 12

Posted 07 April 2012 - 01:58 PM

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
0

#19 User is offline   zebra 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 04-March 12

Posted 08 April 2012 - 05:22 PM

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.
0

#20 User is offline   devnegikec 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 05-March 12
  • Location:Bangalore

Posted 10 April 2012 - 01:31 AM

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/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.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users