Thanks and regards.Hello, I'm trying to put a dropdownlist inside an article but I don't know how, could you help me?, any advice. I use joomla 2.5
All you have to do is insert in your article the HTML code of a drop down list.
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
Go to your article and in the editor you will find a button which is a white page with these symbols: <> (Source Code Editor).
Once you click on this you will see your article in HTML format and you can insert here the code given above and edit it your own way.
Hope this helps.
Related
I have a select input which, using livewire, calls a function whenever the selection changes. According to the documentation you can use $event.target.value to get to the selected value, however I want to send a different attribute value (myvalue) to my function.
<!-- this doesnt work -->
<select wire:onchange="myfunction($event.target.dataset.myvalue)">
<option value="1" data-myvalue="12345">
</select>
I got it working using Alpine.js but it seems odd that I need another framework to do so.
<!-- this does work, but requires alpine.js -->
<select x-data='{}' #change="$wire.call('myfunction',$el.options[$el.selectedIndex].dataset.myvalue)">
<option value="1" data-myvalue="12345">
</select>
Is there a pure livewire solution to this?
Your first code snippet is practically there already. The documentation you linked, in which $event is described, even shows why your code snippet doesn't work:
Your code uses wire:onchange, but Livewire checks for wire:change.
With your example though, you could also use wire:model="foo" and hook into the updatedFoo($newValue) function.
See the lifecycle hooks doc
I try to preselect an option of a select in an embedded HTML form in Camunda Tasklist, but always the first option is preselected.
I followed Binding to a Process Variable:
Binding to a Process Variable
A select box can be bound to a process variable using the cam-variable-name directive:
<select cam-variable-name="foo" cam-variable-type="String">
<option>bar</option>
<option>zar</option>
</select>
Research
I read also CAM-3173:
select box doesn't show the correct option
If I set the value of variable by a select box on the start form, the next task form didn't show the option that has been choosen in the start form. It uses the same select box.
but I use Camunda 7.9 and the problem is fixed since version 7.2.3.
HTML
<form>
<select cam-variable-name="variable" cam-variable-type="String">
<option value="option1">option1</option>
<option value="option2">option2</option>
</select>
</form>
Result
option1 is preselected. I checked the process variable before entering the user task and it contains option2.
What did I wrong? If the bug still exists, is there any work-around?
I found a work-around, see Camunda Reference:
Implementing Custom Fields
The following is a small usage example which combines some of the features explained so far. It uses custom JavaScript to implement a custom interaction with a form field which does not use any cam-variable-* directives.
It shows how custom scripting can be used for
declaring a variable to be fetched from the backend,
writing the variable’s value to a form field,
reading the value upon submit.
[...]
The above example uses jQuery for interacting with the HTML controls. If you use AngularJS, you can also populate the $scope in the variables-fetched callback and read the values from the $scope in the submit callback:
My changed HTML:
<form>
<script cam-script type="text/form-script">
camForm.on('form-loaded', function() {
camForm.variableManager.fetchVariable('variable');
});
camForm.on('variables-fetched', function() {
$scope.variable = camForm.variableManager.variable('variable');
});
camForm.on('submit', function() {
camForm.variableManager.variableValue('variable', $scope.variable);
});
</script>
<select data-ng-model="variable">
<option value="option1">option1</option>
<option value="option2">option2</option>
</select>
</form>
Im trying to bild a joomla component where the user can choose two options (for example yes/no).
Joomla has the possibility to add grouped buttons through an XML file with radio & class "btn-group btn-group-yes-no". However it is also possible to add a form list through JHTML: JHTML::_('select.genericList', $publish, 'published', ' class="inputbox" '. '', 'value', 'text', published)
I can't find it anywhere on the internet, so i think its impossible through JHTML. I want to add a btn-group through JHTML...
Thanks for your effort!
Ron
If you're trying do it for Joomla! 3.x you should just write at the XML file like this:
`<field name="enable_quantity" type="radio" class="btn-group" default="0"
label="Enable quantity"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>`
It's valid with using JForm editing model.
I've been trying to select an item from a pull down list. I've been searching and trying everything. I've tried to search and select by id, xpath, and name. I am at a complete loss. I keep seeing select_by_value but I get the error 'WebElement' object has no attribute 'select_by_value'
The code from the website that I'm trying to select from is as follows.
<input type="hidden" name="wlw-select_key:{actionForm.dobMonth}OldValue" value="true">
<select name="wlw-select_key:{actionForm.dobMonth}" id="dobMonth" class="dobMonth"> <option value="">Select month</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option></select>
I've tried both working with the numerical value and the text value, but neither have worked. I've also tried selecting with the id and then sending keyboard commands. The best that I can get it to do is to open the menu, but it does not change the value.
driver.find_element_by_id('dobMonthSelectBoxItContainer').send_keys("May")
doesn't give errors, but when I find by xpath or name I do get errors. I've been using firepath to get the xpath, which would be
.//*[#id='genderSelectBoxItText']
and
.//*[#id='5']/a
(I've gotten to the 5th page on several google searches :/ Most I see using the select command, but I keep getting that error.)
It's best to use the Select() class when handling a <select> element.
from selenium.webdriver.support.select import Select
select = Select(driver.find_element_by_id("dobMonth"))
select.select_by_visible_text("May")
This is how I handle dropdowns with Selenium
def select_dropdown(driver, dropdown_id, option_value):
dd = driver.find_element_by_id(dropdown_id)
xpath = ".//option[#value='{}']".format(option_value)
dd.find_element_by_xpath(xpath).click()
In your case, if you were trying to select May, as in your example code, it would be select_dropdown(driver, 'dobMonth','05').
I did find a solution, but it is bulky and seems to take more time than necessary. The solution I have created is the following code.
driver.find_element_by_id('dobMonthSelectBoxItText').click()
time.sleep(1) #requires "import time"
driver.find_element_by_id('dobMonthSelectBoxItText').click()
driver.find_element_by_id('5').click()
This seems to open the box twice, but if I remove any line it does not work. I feel that this is bad coding technique, but this is a working solution. I would still appreciate a more elegant solution than this, if anyone finds one.
I am facing an issue working with django ( using shopcart ). I want to add a select options field to change dynamically an item suscription in the cart, but I am not getting the value selected from the template.
In my template where I display the cart I have :
<form action="" method="GET">{%csrf_token%}
<select name="suscr" title="suscr">
<option value="" selected>Suscribe</option>
<option value="1" name="suscr" >Weekly</option>
<option value="2" name="suscr">Monthly</option>
</select>
</form>
I want to select an option and then, if I press 'Checkout' to have the cart updated.
Appart from that, I believe its missing a method modifying the item in cart.py.
Any ideas would help.
Thanks
The above form is inside a loop
{% for item in cart %}
What i propose you to do is not python-oriented but all javascript for the most part as, from the description, we assume that what you are dealing with is going all at the client-side.
As you are dealing with a shopping cart, what i'd do is storing what the user is checking in a sessionStorage so that the information would persist while the user navigates through your website even with multiple tabs. As the user might just be "walking around" you shopping website, there's no need to push things to the database without even knowing if the user wants that. Just remove the form and keep with the select, then you get what the user selected appending an attribute to select: <select onchange=my_function(this.value)>...</select> and then, inside my_functionin a script change whatever you want to the page.
When the user enters the shopping cart page you show him what he selected so far getting the items from the sessionStorageand then, if he/she confirms that wants to buy, then submit a form to the server-side, update the database and proccess that as your workflow states.
tl;dr: store the options in sessionStorage, just post to the server at the end.
For help on the server-side update your question with more info about the cart.py