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

<select> element with multiple attribute containing an <option> element prevents form from being submitted #2741

Closed
dark-ether opened this issue Jun 16, 2021 · 16 comments
Assignees
Labels

Comments

@dark-ether
Copy link
Contributor

dark-ether commented Jun 16, 2021

Describe the bug

a <select> element with the multiple attribute will, if it contains an <option></option>\ element, breaks the submit button which submits the form.

To Reproduce
Steps to reproduce the behavior:

  1. in a new campaign create a token called Lib:test
  2. in the Lib:test token create 2 macros called link and test
  3. in the link macro copy and then paste [r:broadcast(macro.args)]
  4. in the test macro copy and then paste
[h:link = macroLinkText("link@Lib:test","all")]

[frame5("test"):{

	<form action="[r:link]" method="json">
	
	<select id="test" name="test" multiple>
			<option value="option">option</option>
	</select><br/>
	
	<input name="submit" type="submit" value="sucess" name="submit">
	
	</form>
}]
  1. click in the test macro and in the opened frame click the button

Expected behavior
after doing these steps a json element containing the key value pair submit:sucess should appear in chat

MapTool Info

  • Version: 1.9.0 and 1.9.2
  • Install: the Deb package

Desktop (please complete the following information):

  • OS: linux Pop! Os
  • Version 20.10

Additional context
submit buttons which submit other forms in the same frame still work

@dark-ether dark-ether added the bug label Jun 16, 2021
@kwvanderlinde
Copy link
Collaborator

kwvanderlinde commented Jun 17, 2021

First of all, there are a couple of changes that should be made to your code:

  1. Use the r option on the foreach so that it doesn't try print tooltips or anything.
  2. Change the "link" macro to broadcast instead of roll:
    [h: broadcast(macro.args)]
    
    Otherwise the output won't make it to chat.

But even with those fixed, there is certainly an issue with multiple. I did some debugging on Linux Mint 20, and found that this line throws an exception. After adding a catch-all, this is what I found:

java.lang.UnsatisfiedLinkError: 'long com.sun.webkit.dom.HTMLOptionsCollectionImpl.itemImpl(long, int)'
	at javafx.web/com.sun.webkit.dom.HTMLOptionsCollectionImpl.itemImpl(Native Method)
	at javafx.web/com.sun.webkit.dom.HTMLOptionsCollectionImpl.item(HTMLOptionsCollectionImpl.java:88)
	at net.rptools.maptool.client.ui.htmlframe.HTMLWebViewManager.getDataAndSubmit(HTMLWebViewManager.java:622)
	at javafx.web/com.sun.webkit.dom.EventListenerImpl.fwkHandleEvent(EventListenerImpl.java:129)
	at javafx.web/com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
	at javafx.web/com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:813)
	at javafx.web/javafx.scene.web.WebView.processMouseEvent(WebView.java:1020)
	at javafx.web/javafx.scene.web.WebView.lambda$registerEventHandlers$3(WebView.java:1143)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3856)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1851)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584)
	at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$4(EmbeddedScene.java:287)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$5(EmbeddedScene.java:280)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	at java.base/java.lang.Thread.run(Thread.java:831)
Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError: 'long com.sun.webkit.dom.HTMLOptionsCollectionImpl.itemImpl(long, int)'
	at javafx.web/com.sun.webkit.dom.HTMLOptionsCollectionImpl.itemImpl(Native Method)
	at javafx.web/com.sun.webkit.dom.HTMLOptionsCollectionImpl.item(HTMLOptionsCollectionImpl.java:88)
	at net.rptools.maptool.client.ui.htmlframe.HTMLWebViewManager.getDataAndSubmit(HTMLWebViewManager.java:622)
	at javafx.web/com.sun.webkit.dom.EventListenerImpl.fwkHandleEvent(EventListenerImpl.java:129)
	at javafx.web/com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
	at javafx.web/com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:813)
	at javafx.web/javafx.scene.web.WebView.processMouseEvent(WebView.java:1020)
	at javafx.web/javafx.scene.web.WebView.lambda$registerEventHandlers$3(WebView.java:1143)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3856)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1851)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584)
	at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$4(EmbeddedScene.java:287)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$mouseEvent$5(EmbeddedScene.java:280)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:447)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:446)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	at java.base/java.lang.Thread.run(Thread.java:831)

@dark-ether
Copy link
Contributor Author

i was testing some more and if i change the foreach() command for something as simple as [r:'<option value="option">option</option>'] the submit button still breaks, so the bug seems to be more about macro commands printing <option> tags rather than anything specific about loops

@kwvanderlinde
Copy link
Collaborator

Can you try hardcoding the options like this?

<select id="test" name="test" multiple>
    <option value="text">text</option>
    <option value="text1">text1</option>
    <option value="text2">text2</option>
</select>

If you're seeing the same issue I am (and I think it's likely), then this is entirely a bug with multiple and has nothing to do with macros per se.

@dark-ether
Copy link
Contributor Author

dark-ether commented Jun 20, 2021

after trying what you recommended i still saw the bug, which seems to indicate that the problem is with any select element with a a multiple attribute and at least one option element. should i change the issue to better reflect the bug? or close this one and open another one

@Phergus
Copy link
Contributor

Phergus commented Jun 21, 2021

@dark-ether you can just edit this one.

@dark-ether dark-ether changed the title loops inside <select multiple> element prevent form from submitting <select> element with multiple attribute containing a <option> element prevent form from being submitted Jun 21, 2021
@bubblobill
Copy link
Collaborator

tested the following in 1.9.2 Win 10 (tried with multiple and multiple="true")

[frame5("test"):{
<form action="[r:link]" method="json">
	<select id="test" name="test" multiple="true">
	    [r, for(i, 0, 10):'<option value="text'+i+'">text'+i+'</option>']
	</select>	
	<br>
	<input name="submit" type="submit" value="sucess" name="submit">
</form>
}]

Worked as expected producing this output

{
    "submit": "sucess",
    "test":     [
        "text1",
        "text7",
        "text8",
        "text9"
    ]
}

@aliasmask
Copy link

Should this issue be closed now?

@Phergus
Copy link
Contributor

Phergus commented Aug 31, 2021

@kwvanderlinde thoughts?

@kwvanderlinde
Copy link
Collaborator

I don't think we should close this. This may well be JavaFX's fault, but it's our problem and our users not being able to do what they need.

Before this gets closed, we should establish the following:

  1. It's definitely JavaFX's fault and not in any way our fault.
  2. There's no better way to do what we need and which may avoid the issue.
  3. There is an open bug report for JavaFX so they know about it.
  4. There isn't another JavaFX version or build that already fixes the issue.

@Phergus
Copy link
Contributor

Phergus commented Oct 3, 2021

Can someone on Linux test the fixes? Still works fine on Windows.

@Phergus Phergus changed the title <select> element with multiple attribute containing a <option> element prevent form from being submitted <select> element with multiple attribute containing an <option> element prevents form from being submitted Oct 3, 2021
@Phergus Phergus moved this from In progress to Review in progress in MapTool 1.10.0 Oct 3, 2021
@kwvanderlinde
Copy link
Collaborator

Tested latest develop on Linux Mint 20.2. Can submit a form containing a <select multiple>, with all selected values being submitted.

@Phergus
Copy link
Contributor

Phergus commented Oct 3, 2021

@kwvanderlinde I kind of assumed that it would work for you since you submitted the PR. :)

Was hoping someone else that is not the person submitting the fix would test it. Even better would be under a different distro.

@kwvanderlinde
Copy link
Collaborator

Yeah I figured as much, just didn't want to leave you hanging there!

Testing on a Mac would be good as well. When I was looking through the library symbols, I noticed the Macs binaries are missing the same symbols as the linux binaries and so should be experiencing the same problem. This bug report on Melek's lib:elevation confirms that suspicion.

@Phergus
Copy link
Contributor

Phergus commented Oct 4, 2021

Yup. Looking closer I see that you updated the run section of the build file but not the jpackage section. Going to need both.

@Phergus
Copy link
Contributor

Phergus commented Oct 6, 2021

Tested latest changes with a jpackage build and still working under Windows.

Confirmation of same under Linux and Mac would be nice.

@Phergus
Copy link
Contributor

Phergus commented Oct 6, 2021

Closing for now. If problems show up can be addressed then.

@Phergus Phergus closed this as completed Oct 6, 2021
@Phergus Phergus moved this from Review in progress to Reviewer approved in MapTool 1.10.0 Oct 6, 2021
@Phergus Phergus moved this from Reviewer approved to Done in MapTool 1.10.0 Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

5 participants