Opened 6 years ago

Closed 6 years ago

#9374 closed bug (notabug)

on click event on autocomplete combobox

Reported by: mcapp32 Owned by: mcapp32
Priority: minor Milestone: none
Component: ui.core Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

Description

I have multiple Autocomplete combo boxes on my MVC view.

The first one.. i have and onchange(html shows as onclick when it runs) function to turnOnOverlay(); submit.form(); This basically goes and posts to the controller, and gets data back and populates and sets the values for up to five other autocomplete combo boxes on the form.

Prior to adding the JQuery Autocomplete.. the function worked and posted back and populated the other dropdowns.. After I implemented the AutoComplete. (no _change function) as there are other dropdowns that do not need this form.submit(); It stopped doing the submit.

I do not have a _change function in my js as with the html.dropdown.. i have the ability to have an onchange.

see below:

<div class="ui-widget">

@Html.DropDownList("DKID1", (List<SelectListItem>)ViewBag.DKID, (string)ViewBag.DimensionKey1, new

{

disableValidation = "true", onchange = @"

turnOnOverlay(); form.submit();"

})

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="btnAddDimensionKey" value="New" onclick="showAddDimensionKey();" />

</div>

Can you think of any reason this won't work? Is there a way for me to in the .js force a submit on change of just the specific Autocomplete combo box?

Any help with this would be greatly appreciated.

Thanks

Mary Cappello

Change History (7)

comment:1 Changed 6 years ago by tj.vantoll

Owner: set to mcapp32
Status: newpending

Hi mcapp32,

We'll need a reduced test case free of server side code in order to look into this. But it sounds like you need to use autocomplete's change event: http://api.jqueryui.com/autocomplete/#event-change.

comment:2 in reply to:  1 Changed 6 years ago by mcapp32

Status: pendingnew

Replying to tj.vantoll: Hi.

I do have the event change in my js.

The bug tracking is giving me issues as far as pasting the code in here..

I have several dropdowns. The first drop down is the one that has the event change code on it.

http://jsfiddle.net/3Gm2g/1/ what i noticed right off the bat in the jsfiddle.. is that my drop boxes do not show all the css.. they do not appear to be taking the jQuery css. but I think from what I have in there you should be able to look at the JS and the html and see what might be wrong.

or if you have a working example of a dropdown with autocomplete that will do a form.submit on change that would be helpful.

Thanks so much for your help.

Thanks. Mary

Hi mcapp32,

We'll need a reduced test case free of server side code in order to look into this. But it sounds like you need to use autocomplete's change event: http://api.jqueryui.com/autocomplete/#event-change.

Last edited 6 years ago by mcapp32 (previous) (diff)

comment:3 Changed 6 years ago by tj.vantoll

Status: newpending

It's very difficult to figure out what's going on in your example. Please reduce your example to the absolute minimum amount of code needed to show the issue you're having.

If you need support try the forums or Stack Overflow.

comment:4 in reply to:  3 Changed 6 years ago by mcapp32

Status: pendingnew

Replying to tj.vantoll:

Good Afternoon:

I did try finding a solution in the forums.

I've trimmed down the code: http://jsfiddle.net/3Gm2g/2/

Please note.. what it is supposed to do is a form.submit() on the change of the DKID1 dropdown. The problem is with the jQuery Autocomplete on the dropdown it will not do the form.submit. However, if it does not have the jQuery Autocomplete it will. the problem is the list is so huge normally that they would be scrolling to find what they want ... This really should be simple.. you can see that there is an onchange event. there is in the <select ... onchange="turnOnOverlay(); form.submit();" the overlay just dims the form while it does the submit.. however with the Autocomplete on the dropdown it will not run either command.

Hopefully you'll see something that I'm missing.. Do you have any example of doing a form submit in MVC using on change on a combo box?

Thanks again.

It's very difficult to figure out what's going on in your example. Please reduce your example to the absolute minimum amount of code needed to show the issue you're having.

If you need support try the forums or Stack Overflow.

Last edited 6 years ago by mcapp32 (previous) (diff)

comment:5 Changed 6 years ago by tj.vantoll

Status: newpending

There's still a lot going on in this example and I get a syntax error.

comment:6 in reply to:  5 Changed 6 years ago by mcapp32

Status: pendingnew

Replying to tj.vantoll: Basically it's 1 drop down with an onchange event that needs to do a form.submit. after the form submit the other 5 drop downs get updated with a selected item.

With all the stripping out I could see why there might be an error.

Do you have an example of an autocomplete drop down that will do a form submit. I have tried all the possible solutions that I've found on the internet but none of them work.

With all the code on the form and controller, I do not get a syntax error, but It also will not do the submit. If i take the JQuery Autocomplete off the drop down it does the submit.

You guys must have some kind of an example that has code that works and will execute the form.submit() from the onchange event. Could you just give me something like that, that I can implement?

Thanks.

There's still a lot going on in this example and I get a syntax error.

comment:7 Changed 6 years ago by tj.vantoll

Resolution: notabug
Status: newclosed

You'll want something like this: http://jsfiddle.net/tj_vantoll/2f7th/. This is not the place for support so please take further questions to the forums or Stack Overflow.

Note: See TracTickets for help on using tickets.