Post by nortgraf » Tue Oct 17, 2023 12:31 am

So I would like help from my colleagues:
I created a button in the order details in the customer area that sends me to a form, I want to fill in the input of this form with the order number and a text.

I managed to ensure that when clicking on the button, the customer is directed to the form and the input is already filled in with the order number, but in this same input I would like to insert text before the number.

Ex: Order #99999

All that remains is to enter the text: Order#

Code: Select all

<input type="text" name="subject" value="{{ subject }}" placeholder="{{ entry_subject }}" id="input-subject" class="form-control" />
I'm using this to fill in the subject field, it fills in correctly but just the number, I would like to include an attribute in this script to fill in text before the order number.

Code: Select all

$.urlParam = function (name) {
    var results = new RegExp('[\?&]' + name + '=([^&#]*)')
                      .exec(window.location.search);

    return results[1] || 0;
}
$("#input-subject").val($.urlParam('order_id'));

Newbie

Posts

Joined
Tue Oct 17, 2023 12:28 am

Post by ADD Creative » Wed Oct 18, 2023 5:10 am

Not sure if you are just asking how to concatenate strings in JavaScript.

Code: Select all

$("#input-subject").val('Order #' + $.urlParam('order_id'));

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 9 guests