Dynamically add a new field to a form in Ember? - ember.js

I am trying to dynamically add a dropdown to a form using Ember. I am new to Ember and don't know where to start with this. I am thinking I need a way to render a select box after the page has already been rendered while also incorporating the new element into the model.
The flow would be something like: 1. click button, 2. a select is created, 3. select an option, 4. repeat 1 thru 3 adding as many options as necessary, 5. submit form.
Here is a graphic of the selector generator
I can't find any documentation to help with this. Is there anyone that can help?

Related

Custom Product.tpl with declination crash when select attribute and url change Prestashop 1.7

I have to create a custom page for only one product with declinations, so I have created "product-158.tpl" file with a new hook for a new module. (158 is the ID of the targeted product)
The page works well when the product is not to complicated to select, but if I need declinations as color or size, the new layout is replaced by classic product.tpl version and every customed things desapeared. The problem comes when the hidden "refresh" button is trigged and the "add-to-cart-or-refresh" form is submitted. If I erase the hidden button, I can select what I need to select, the cart recognise my order, I can buy the right declination, but If I click the "continue shopping" button, the same problem is displayed.
The problem comes when url change, maybe because of the new ID of the product, I really don't know. I'm searching from two month.
Thanks a lot to who will help me.
Why not park the base tpl, and call your hooks, and apply only changes that the product ID is 158?
Regards

How to fill dynamic form fields using capybara

I have a form that contains a select box and a text field.
The text field is displayed dynamically based on the selectbox selection. If the value of selectbox is "Yes", then the text field will be displayed and vice versa.
I am running an rspec test and filled the select box value with "Yes"
select 'Yes', from: 'property[have_water_bills]'
Now i want to fill a value on the text field
fill_in 'property[irrigation_cycle_count]', with: 5
But i am getting the following error.
Capybara::ElementNotFound:
Unable to find field "property[irrigation_cycle_count]"
That is, capybara cannot find the dynamic element. Does anyone know how to fix this?
Poltergeist doesn't gemerate a click event when choosing an item from a select. It generates a focus on the option, change on the select, blur on the option. It is more like if a user selected the option with keyboard instead of using a mouse. You probably should be doing the logic to display your text field on the change event anyway so that it works if people use a mouse or a keyboard to navigate around your page. It also makes more sense to run your show/hide logic on the change event because that's what you actually care about, not clicks.
Finally got this to work using the following piece of code
page.execute_script("$('#have_water_bills').val('true').trigger('click')")

cant assign any modules to category layout in Opencart 2

I have a Opencart 2.0.1.1 installed on my server with a few modules installed but I cant seem to assign them to the category layout.
for an example, I have a banner and I have assigned it to the category layout but it doesnt show. But when I assign it to any information page or home page it shows.
none of the a modules work for the category layout. There are no errors in the error log either
Can someone let me know what might causing this problem and how can I fix it?
I have the same problem with Version 2.3.0.2. Maybe you already solved it; but in case anyone else needs a solution I found a workaround: Create a new Categories Layout to which you assign your modules. Next, assign your new layout to each category by overriding the standard layout of each of your categories with the one you just created.
In case you need some directions, here's how to do this:
In the admin section go to Design > Layouts. Create a new layout for your category pages by clicking on the plus sign in the rop right of the screen (it says 'Add New' when you hover over it). The new screen will show a fresh layout; give it a unique name in the field 'Layout name'. Now click on the plus sign below the line that says 'Store' and 'Route'. This creates two empty fields in which you can fill in your store and route. Select the name for your store (mine is simply 'default') and in the route field enter 'product/category' (without the quote marks). Now assign the modules of your choice in this new layout. When you are done save the layout by hitting the save button in the top of the screen.The next step is that you assign your new categories layout to all your existing categories. Go to Catalog > Categories and open the first category on your list by hitting it's edit button. In the edit screen, go to the tab 'Design' and select your newly created layout in the dropdown list under 'Layout Override' . Hit the Save button and edit the next Category in the same manner. Go through the entire list and you are done. …That's it :)

Django multi-select widget. Add arbitrary select components

i would like to make a widget that lets the user select a value from a drop-down list and then add new drop-down lists with values filtered based on the previous selections. I don't know where to start from....
If the amount of drop-downs is finite and determinable by the time you develop the software (e.g. selecting country->city->street) I would suggest to:
add all the extra dropdowns (without data yet) to your form, make sure they are hidden
use jqueryui to un-hide and populate the dropdowns as needed using ajax
Don't forget to disable/hide the whole form by default and only show it if JS is enabled in browser.
Also, you will of course need another view, with which only ajax speaks.
Here for you to catch the idea how the stuff should work. Sorry don't know if they have anything more similar. But: user selects something -> jquery requests data for the next dropdown -> jquery displays next populated dropdown.

How to add a hyperlink column in an UltraWebgrid that will redirect me to a popup window

I am pretty new to Infragistics controls and finding it hard to add a hyperlink column to the ultraweb grid. Can anyone help me out with this.
Currently, I am binding the data coming from the Database to the grid.
To this data I need to add a hyperlink column "View" that will redirect me to a popup.
I need to pass some values from this page to the popup.
Need pointers if this can be done on Javascript.
I am unable to get the code anywhere.
It would be really helpful if someone can help me out
Regards,
Sunitha
If you know HTML it is actually pretty simple to do. On the Initialize RowLayout method of the UltraGrid and reference the cell you want the hyperlink to go into and within the text property place the link there using HTML and include parameters within the HTML to pass to the popup.
If you are using a fairly recent version of Infragistics, they have a Modal Popup window that you can use which is fairly easy to integrate and use, and with this you do not need a javascript popup. You can use the ClientSideEvent BeforeSelectChangeHandler to open the Modal popup and pass values into there by referring to other cells within the row.