Changing attribute with javascript doesnt trigger onChange

1
I have a radio button group connected to an ENUM. I set the onChange property to call a microflow. If I change the radio values, the microflow executes. If I use javascript to change the value, the microflow does NOT execute. In fact, if I just change the onChange event to "save", it still won't save if changed by javascript. Does anyone know why? The reason it has to be javascript: I'm writing an app that checks whether a bunch of URL's are reachable and if they aren't change some values. I have to use javascript to check if the URL's are pinging or not because in mendix there doesn't appear to be any server/microflow methods that can ping a URL
asked
2 answers
1

Do you mind providing a screenshot?

Unfortunately, I don’t have 9.7 around.

 

If I were to do this on 9.21, I would call a Nanoflow and execute just the ping call itself in javascript. Then based on that result you could mutate the object within the Nanoflow which would trigger the appropriate update within the UI.

 

Edit: If you have to do this server-side, just write some Java Actions using the appropriate library. Server-Side functionality is not limited to what is provided by the platform and/or Marketplace Modules.

answered
0

I know I always get gunned down for this, but why not use a java action to do this?
google for java code to ping url… one of the results:

 

import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;

public class CheckUrl extends CustomJavaAction<java.lang.Boolean>
{
	private java.lang.String Url;
	private java.lang.Long Timeout;

	public CheckUrl(IContext context, java.lang.String Url, java.lang.Long Timeout)
	{
		super(context);
		this.Url = Url;
		this.Timeout = Timeout;
	}

	@java.lang.Override
	public java.lang.Boolean executeAction() throws Exception
	{
		// BEGIN USER CODE
        Url = Url.replaceFirst("^https", "http"); // Otherwise an exception may be thrown on invalid SSL certificates.
    try {
        HttpURLConnection connection = (HttpURLConnection) new URL(Url).openConnection();
        connection.setConnectTimeout(Timeout.intValue());
        connection.setReadTimeout(Timeout.intValue());
        connection.setRequestMethod("HEAD");
        int responseCode = connection.getResponseCode();
        return (200 <= responseCode && responseCode <= 399);
    } catch (IOException exception) {
        return false;
    }
		// END USER CODE
	}

	/**
	 * Returns a string representation of this action
	 */
	@java.lang.Override
	public java.lang.String toString()
	{
		return "CheckUrl";
	}

	// BEGIN EXTRA CODE
	// END EXTRA CODE
}


Note: Timeout is in ms

 

And the result of the java action:

 

 

 

answered