If there's no ajax GET, then the js function is not attached properly. you're using renderPartial ( x, x, x, TRUE) which is correct. Have you ever used VisualEvent ? (http://www.sprymedia...le/Visual+Event) Install, then check a page where the autoCompleter is working properly. You should see the js event attached to the correct widget. In my working application, each EJuiAutoCompleteFkField widget has *6* events subscribed. Hover your cursor over each to see the js function for the event. Now, go to the non-working page. Use Visual Event again - are there any attached events?

Daniel, on 01 August 2011 - 08:57 PM, said:

Hi Jeremy,

I checked the response from firebug, nothing is called there..... is there because of the indexing? what I suppose to do in a situation where the _formDetail is called by a javascript function?

If there's no ajax GET, then the js function is not attached properly. you're using renderPartial ( x, x, x, TRUE) which is correct. Have you ever used VisualEvent ? (http://www.sprymedia...le/Visual+Event) Install, then check a page where the autoCompleter is working properly. You should see the js event attached to the correct widget. In my working application, each EJuiAutoCompleteFkField widget has *6* events subscribed. Hover your cursor over each to see the js function for the event. Now, go to the non-working page. Use Visual Event again - are there any attached events?

Hi, Jeremy,

Thanks for quick reply.

I installed Visual Event, and right on my working page, I saw 6 events. On my non working page, I can only see 1 event which is the onBlur.......I guess this is why it is not working. however, any hints to fix this? something related to the attributes?

Moreover, since I can add the new row from javascript, no new jquery autocomplete is genereated when arow is added. Any suggestion to this problem?

I remember that we should be able to attach a jquery script to a class not just an id, but no idea how could this be working in my situation......

and see what happens. If it works I'll patch the extension and release a new version.

- Jeremy

Daniel, on 01 August 2011 - 10:29 PM, said:

I installed Visual Event, and right on my working page, I saw 6 events. On my non working page, I can only see 1 event which is the onBlur.......I guess this is why it is not working. however, any hints to fix this? something related to the attributes?

Moreover, since I can add the new row from javascript, no new jquery autocomplete is genereated when arow is added. Any suggestion to this problem?

I remember that we should be able to attach a jquery script to a class not just an id, but no idea how could this be working in my situation......

See attached code. I *think* this version is working properly for [$i]fieldName, as well as for fieldName. If working, I'll publish the new version on the Extension homepage. Thanks for your patience. You're helping to improve the extension.

See attached code. I *think* this version is working properly for [$i]fieldName, as well as for fieldName. If working, I'll publish the new version on the Extension homepage. Thanks for your patience. You're helping to improve the extension.

- Jeremy

Hi Jeremy,

Thanks a lot for your support. I tried on my code, and it works only for the first row. I wonder why it failed on the next row. Either, I generate from (+) button which is a javascript, or from the yii, prelaoded the create form with 3 details.

I don't know whether this info is useful, if I compare the textfield next to it is product, the id would be TransactionDetail_x_productFk while on your extension it is only TransactionDetail_warehouseFk. Since all id would be TransactionDetail_warehouseFk, it would be difficult to distinguish which one is belong to which id.

I am really thank you for your patience and kindly support to answer my questions.

I don't know whether this info is useful, if I compare the textfield next to it is product, the id would be TransactionDetail_x_productFk while on your extension it is only TransactionDetail_warehouseFk. Since all id would be TransactionDetail_warehouseFk, it would be difficult to distinguish which one is belong to which id.

Yes, the whole problem is getting the IDs to be correct, and unique.

Quote

Thanks a lot for your support. I tried on my code, and it works only for the first row. I wonder why it failed on the next row. Either, I generate from (+) button which is a javascript, or from the yii, prelaoded the create form with 3 details.

Are you sure it doesn't work for the existing rows? I have it working properly in my application for 20+ child rows, with valid autocompleters on each. But in my app, new rows cannot be created.

The problem with creating new rows is the autocompleter never gets attached to the field. This happens in anonymous js function that is executed after the page loads. Look at the very bottom of the HTML source and you'll see it., like this:

jQuery('#FIELDNAME').autocomplete({...

When you add a row using js, does it create another jQuery command like the one above? Please try and post the result here.

It seems the problem is due to using renderPartial to show the existing and the new rows. My view does not use renderPartial(); each detail line is rendered as part of the parent form. But as I wrote before, in my case new rows are not allowed. I understand why you are using renderPartial(), this is correct for your situation.

Unfortunately I do not have time to make the extension work in this situation, right now. I am not sure it is possible to attach the jQuery autocomplete to an ajax response; but I haven't tried it yet. If you are able to improve it for your situation please post the code or send it to me; if it seems generally useful I'll incorporate back into the extension and republish.

The one thing I find puzzling about your last post is the Firebug screenshot, which shows the fieldname is -not- numbered. Even though you are using renderPartial the fieldNames should still get numbered properly. Are you definitely using the code I posted in this forum a few days ago?

It seems the problem is due to using renderPartial to show the existing and the new rows. My view does not use renderPartial(); each detail line is rendered as part of the parent form. But as I wrote before, in my case new rows are not allowed. I understand why you are using renderPartial(), this is correct for your situation.

Unfortunately I do not have time to make the extension work in this situation, right now. I am not sure it is possible to attach the jQuery autocomplete to an ajax response; but I haven't tried it yet. If you are able to improve it for your situation please post the code or send it to me; if it seems generally useful I'll incorporate back into the extension and republish.

The one thing I find puzzling about your last post is the Firebug screenshot, which shows the fieldname is -not- numbered. Even though you are using renderPartial the fieldNames should still get numbered properly. Are you definitely using the code I posted in this forum a few days ago?

Hi Jeremy,

not sure yet how to do it. Someone mention about using .live, do you have any idea?

Hi Jeremy,
First I wanted to say thanks for pulling this extension together, it is really helpful.

I have a problem that is confusing to the end users. If there is an error on any other value on the form that is not the EJuiAutoCompleteFkField, this field will then display the fk id and not the item that was in the auto complete drop down.

For example. I am using the field to select a city. So the user starts typing city names and the auto complete drop down works as it should and the user selects their city. But if they make an error anywhere else on the form the city field will now show the id (i.e. 456) instead of the city name they selected originally. I tried force setting this in an after find function but could not get that to work either. This is confusing to the end user so they go and try to type over that id with the city name again and only every once in awhile with the auto complete work without refreshing the whole page.

Hi Jeremy!
I have also problem as Márcio Coragem.
For example in first autocompleate field i choose city.
And in second autocompleate field i must to choose street in the city choosen in first field.
How i can to do it? (I mean second field with street).

Any ideas why I would be getting the following error, when inserting a new row into my database:

Trying to get property of non-object

Here is call for the auto complete field:

$this->widget('EJuiAutoCompleteFkField', array(
'model'=>$model_main,
'attribute'=>'ordered_for_location_id', //the FK field (from CJuiInputWidget)
// controller method to return the autoComplete data (from CJuiAutoComplete)
'sourceUrl'=>Yii::app()->createUrl('ordersWls/FindLocations'),
// defaults to false. set 'true' to display the FK field with 'readonly' attribute.
//'showFKField'=>true,
// display size of the FK field. only matters if not hidden. defaults to 10
'FKFieldSize'=>15,
'relName'=>'ordersWlsDiscSusps', // the relation name defined above
'displayAttr'=>'StreetCityAndState', // attribute or pseudo-attribute to display
// length of the AutoComplete/display field, defaults to 50
'autoCompleteLength'=>80,
// any attributes of CJuiAutoComplete and jQuery JUI AutoComplete widget may
// also be defined. read the code and docs for all options
'options'=>array(
// number of characters that must be typed before
// autoCompleter returns a value, defaults to 2
'minLength'=>3,
),
));