Appsmith to change the default value of the Input Box - appsmith

The Process
I am going to use Appsmith to edit the item price using rest API
The Item List Table
Code
{{menitems.data.content}}
Explanation
From the Image, I have been Displaying my Item with the Edit Button in a table that I got from Rest API
While Clicking I have been showing Item's details and the price to be changed
While Clicking the Edit Price Button
I have been Passing the Price from Table to the javascript object which I have been using storevalue to store the price which I will get the price and show in the popup
Code for Passing Table data to the Javascript Object
{{priceCalculation.openModal(currentRow.pricetype,currentRow.price)}}
Description
I have been passing the price from the table to the popup using the above code
Javascript Object code Open a Modal and storeValue
openModal:(price) => {storeValue("price",price);}
Description
Then in the Javascript object, I have been using storeValue to save in a local storage
The Modal Popup
Explanation
As you can see I have been getting the price from storeValue and adding in the input box's Default Value
In the Popup Price Input
{{appsmith.store.pricebefore}}
Description
From the above code I have been adding the price from the store value
Problem
When I change the text it rolls back the value from the storeValue
For Example
price in storeValue = 300
if I tried to change the price input to = 200
then the input price rolls back to = 300
Solution Tried
in the price Input onTextChanged
{{(function({storeValue("pricebefore",price_before_discount.text);priceCalculation.price_before_change(price_before_discount.text);})()}}
Description
In the above code I have to change the text in storeValue too but it's way too slow if I edit too fast like double clear and add text way fast then it's taking too much time to reflect by the time it reflects it's rolling back the value in storeValue
For Example:
The Text in Input = 12345
if I press double bacspace then it's too slow it only clears one
in the price input onSubmit
If I use this it's working fine on Desktop but on mobile I can't
submit the Input there is no Tick button on keyboard
Conclusion
I just need an alternative using the process of getting the price from the table and putting in the input and allowing the user to edit that input without interference

Related

My query, getting value from a textbox inside a subform, shows "small box"

The overall scenario: Actually trying to implement an order entry
system. A button on the main form opens 2nd form. In the 2nd form,
there are some combo-boxes and list-boxes from which the user selects
an item. Then pressing a button add that item with append query.
The problem is, as soon as I click anywhere in the 2nd (child) form;
the the id (autonumber) from parent vanishes(becomes null) for new
entry in the 2nd form. (I have lately discovered this vanishing by
using a text box to show current parent-id. Also found a solution,
posting as an answer)
I am trying to get two values from a textbox and a combo box. In the query datasheet view, i checked that, one value is received correctly but the other value it shows a very small box (putting picture below)
)
In this picture, "Expr2" field is showing small box. I used below statement to pull value from subform:
Expr2:[Forms]![customer_f]![products_add_subf].[Form]![customer_id]
And here is the code in sql-view:
INSERT INTO products_t ( product_name, customer_id )
SELECT [Forms]![customer_f]![products_add_subf].[Form]![item_combo] AS Expr1, [Forms]![customer_f]![products_add_subf].[Form]![customer_id] AS Expr2;
What this small box mean and how to avoid it ? How to pull correct value instead of small box ?
The solution will prevent vanishing of parent-id from first form(parent); in the 2nd form (child).
Just disable "Allow Addition" in the 2nd form's property.
Steps:
Open the 2nd form in "design view" . Double Click at the upper left corner of the form to open its property sheet. Goto "data" tab. In the "Allow Addition" select "no".
Now your append query will be able to grab the parent id field. It will not vanish !

How to choose custom quantity for each record row in Bartender?

I have the following template set up on bartender
Product Code: Barcode: Quantity:
0001 1234 0
Idea
The page is set up with 1 column and 3 rows. Next, select maximum of 3 records from record picker. The 3 records chosen will then be automatically filled out onto the page.
(Records are from SQL Database)
I have a form set up with a record picker. If I choose 3 random records from the database. The output would be something like this:
Product Code: Barcode: Quantity:
0001 1234 0
0002 1235 0
0003 1236 0
My Question is
when pressed Print. How can I adjust the quantity for each record?
Images:
Data Entry Form
Data for each row
Page template
There are two solutions for your problem. The first and my preferred is to add a column for quantity. Simply right click on the record picker and choose properties. go to the tab Record Picker and search for the option "Selector Column". If you change this to Quantity, you will be able to add a unique quantity for each record and you can remove the number input box.
The second solution is to use the number input box. Simply linking it to the copies field should do the trick but you will need to run the form multiple times to print every record since it will close after every print. To link the field just look to the left side of the screen when your in the form builder and drag "copies" on the number input box. To solve the issue of the form you can use an option "repeat data entry until cancelled. This will reopen the print form until you close it. you can select this option in the print screen (ctrl+p) and select Options in the lower half of the screen. Select the option "repeat data entry until cancelled" and you're set.

Shopify selected variant id to update

I have an inquiry form built into my Shopify product page.
Where they can request a callback in regards to the product they're on and the variant id select.
I'm able to call back the current selected variant ID
product.selected_or_first_available_variant.id
But if I change the drop-down selection to another variant, this id will not update.
How do I may this update on the selection of a different variant?
Thank you
Correct - the {{ product.selected_or_first_available_variant.id }} is a Liquid variable, and Liquid is parsed server-side to generate the HTML document that is sent to the browser. Liquid can only ever be accurate as of the time of the initial page load
If you want to respond to user changes after the page has loaded, you'll need to use Javascript. If you are on a product page, there will be some javascript function firing that updates the price, image, etc. when the variant changes. If you can find that function (often, but not always, called selectCallback), you could add the code needed to update your contact form in there.
If you just need a variant ID, one other method to get it would be to write a small javascript function which, on submit of your contact form, takes the current value from the variant ID field in the product form and puts that value into the appropriate field in your contact form.
Hope this helps!

Beginner Oracle APEX - Using ITEMS for a query

So I'm trying to select some names from a table where their set dates are between two dates that I enter via keyboard.
If it was for a single input, where I only use something like (:x) in the region source, I could just create a Text Field Item X where I enter something and press ENTER.
What if I need multiple inputs? like (:x) and (:y).
Upon creating 2 items and entering their values nothing happens when I press ENTER.
The Region Source is this:
SELECT * FROM TOYS WHERE SALE_DATE BETWEEN upper(:x) AND upper(:y);
What am I supposed to do in order to enter two inputs?
If you need to initiate an action (submit the page, for example) by changing value, you have to find a property Submit when Enter pressed in item's settings and set it to Yes. For select lists, the same property is Page Action on Selection, and desired value for it - Submit Page.
Or, you can just create a button. Button's action by default is also "submit page".

How do I use onChange function to reset a field in Odoo11? (Barcode Scan)

there is a barcode field (type: char) in my module, and it holds the scanned barcode value of a product that scanned by using a barcode scanner. This scanned product will be added to the line field(type: one 2 many) in in the POS order. After this, the barcode field should be get cleared for the next product's barcode. This work in Odoo10 but, it's not working in Odoo11. In Odoo11, for the working of onchange, we have to change the value in that Barcode field and press enter or click on save button and edit. Then it will work. But, I need after the scan, that field should be get cleared.
I have given a piece of code below. Waiting for the right solution. Thanks in Advance. :)
class PosOrder(models.Model):
_inherit = "pos.order"
barcode = fields.Char('Product')
#api.multi
#api.onchange('barcode')
def _onchange_barcode(self):
for record in self:
#my codes
record.barcode = ""
print ("Value in Barcode field is ",record.barcode,". Have nice time")
The above code will print the following line in the terminal:
Value in Barcode field is . Have nice time
It sets the barcode field as blank but, it will not affect in the front end. I have attached a screenshot with this.