Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onclick handler doesn't work after click on 'Submit' button in form #1291

Closed
helen-dikareva opened this issue Sep 4, 2017 · 2 comments
Closed
Assignees
Labels
AREA: client STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@helen-dikareva
Copy link
Collaborator

helen-dikareva commented Sep 4, 2017

Converted from a question on the Discuss forum. Can be reproduced in playground.

test.js

import { ClientFunction } from 'testcafe';

fixture `f1`.page `./temp.html`;

test('t1', async t => {
 await t
        .typeText('#text', 'Testing')
        .click('#save_button');

 const getSearch = await ClientFunction(() => location.search);

 await t.expect(getSearch()).eql('?action=Save&text=Testing&button=Save');

});

temp.html

<html>
    <head>
        <title>Tets page</title>
    </head>
    <body>
        <form action="temp.html" method="GET">
            <input id="action" name="action" value="Edit" hidden />
            <input id="text" name="text" type="text" />
            <input title="Save" onclick="this.form.action.value='Save'" type="submit" name="button" id="save_button" value="Save" />
        </form>
    </body>
</html>
@LavrovArtem
Copy link
Contributor

Simplified example:

<form action="temp.html">
    <input name="action" value="something">
    <input name="button" value="Change action field" type="button">
</form>
<script>
    var form = document.querySelector('form');
	
    form.button.addEventListener('click', function () {
        form.action.value='something else';
        alert(form.action);
    });
</script>

Without proxy the input field changes value to something else and alert [object HTMLInputElement] after click.
With proxy the input field doesn't change and alert action url after click.

I'm working on this.

@LavrovArtem LavrovArtem assigned LavrovArtem and unassigned miherlosev Sep 5, 2017
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Sep 5, 2017
@LavrovArtem LavrovArtem changed the title Onclick handler probably doesn't work after click on 'Submit' button in form Onclick handler doesn't work after click on 'Submit' button in form Sep 6, 2017
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…tton in form` (close DevExpress#1291) (DevExpress#1294)

* fix `Onclick handler probably doesn't work after click on 'Submit' button in form` (close DevExpress#1291)

* test refactoring
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AREA: client STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

3 participants