3

I am Creating custom product add form in magento2.2.2.
I have added a new tab after product details & Loaded My custom phtml File into It,

First To Post Data from product form to observer, i added data-form-part="product_form" To input Fields Like:-

< input type="hidden" name="test" id="test" data-form-part="product_form" value="oldValue" / >

Now, When I click on save I called a event Like Below.

$(document).on('click','button[title="Save"], button[title="Duplicate"],  button[title="Save and Continue Edit"]',function(){
        $("#test").val('NewValue'); //Here I Changed Value According To My Requirement
});

In MyObserver.php For getting that hidden field value i used $this->_request->getPost();

By Printing Post Data of Test Hdden Input i got OldValue Instead of NewValue which is changed in jquery handler.

Any Solutions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.