Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #104262
    jqwidgetsdev
    Participant

    Hi,

    In the method POST example below, why would the form variables appear in the browser URL? That is what I would expect with method = GET

    form.submitOptions = {
                async: true,
                action: "<omitted>",
                target: "",
                method: "POST"
            };
    
    form.submit()

    Really I don’t want the form to refresh at all. Is there a way to achieve this?
    Also please clarify what target determines the submit target means.

    Thank you.

    #104269

    Hi,

    There is no such property ‘submitOptions’. You may set the method, action and target in the form tag as attributes.
    Here is an example of that: https://codepen.io/svetoslavb04/pen/oNMEoXN

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

    #104277
    jqwidgetsdev
    Participant

    Hi Svetoslav,

    Thanks for the example, I understand it now.

    BTW the reason I arrived at

    form.submitOptions = {
                async: true,
                action: "<omitted>",
                target: "",
                method: "POST"
            };

    is because of this https://www.htmlelements.com/docs/form-api/

    submit( submitOptions?: any): void
    Submits the form.
    
    Arguments
    submitOptions?any
    Sets the submit options object. The object may have the following properties: async, action, target, method. async determines whether the form will be submitted asynchronously. action determines the submit url, method sets whether the submit is through 'GET' or 'POST'. target determines the submit target.

    Maybe the documentation can be updated?

    Best regards.

    #104282

    Hi,

    These options can be passed to the ‘submit’ method, not to the form itself

    I hope your problem is now resolved!

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.