Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Issue with myDynamicForm.getValueAsString("myHiddenField")

    Hello, I think there is an issue in the nightly build of 13-12-2010 Power edition. A testcase is pasted below.

    The method...
    Code:
    aDynamicForm.getValueAsString("aHiddenItem");
    ...in the code below is returning null. I've checked that a successive call to HiddenItem.setValue and HiddenItem.getValue gives the correct result. Also, the getValueAsString("aTextItem") works okay, it is just the HiddenItem.

    This used to work in the officially 2.3 release of the Power edition.

    Some details about my tested situation:
    1. it occurs in Hosted mode, haven't tried deployment mode.
    2. it only seems to occur with HiddenItem
    3. nightly build of 13-12-2010 Power:
    Code:
    INFO  ISCInit - Isomorphic SmartClient Framework (SC_SNAPSHOT-2010-12-13/PowerEdition Deployment 2010-12-13) - Initialization Complete
    Usage: paste the private class, extending a DynamicForm below in a class with an entrypoint method, and start it up using it's constructor. You can use the empty string as constructor argument. After clicking the 'Login' button, you can debug to the issue. Observe the params HashMap, to be specific, after the getValueAsString() method has been called.
    Code:
    private class LoginForm extends DynamicForm {
    	private String credentialsURL;
    
    	public LoginForm(String credentialsURL) {
    		this.credentialsURL = credentialsURL;
    		HiddenItem hostname = new HiddenItem("hostname");
    		String s = "someHostname";
    		hostname.setValue(s);
    		String x = (String) hostname.getValue();
    	
    		TextItem textItem = new TextItem("username");
    		textItem.setTitle("Username");
    		textItem.setTitleOrientation(TitleOrientation.LEFT);
    
    		PasswordItem passwordItem = new PasswordItem("password");
    		passwordItem.setTitle("Password");
    		passwordItem.setTitleOrientation(TitleOrientation.LEFT);
    
    		ButtonItem buttonItem = new ButtonItem("Login");
    		buttonItem.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent clickEvent) {
    				doLogin();
    			}
    		});
    		setFields(hostname, textItem, passwordItem, buttonItem);
    
    	}
    
    	public void doLogin() {
    		RPCRequest request = new RPCRequest();
    		request.setContainsCredentials(true);
    		request.setActionURL(credentialsURL);
    		request.setUseSimpleHttp(true);
    		request.setShowPrompt(false);
    		Map<String, String> params = new HashMap<String,String>();
    		params.put("j_username", getValueAsString("username"));
    		params.put("j_password", getValueAsString("password"));
    		params.put("j_hostname", getValueAsString("hostname"));
    
    		request.setParams(params);
    	        //submitting code of RPCmanager omitted...
    	}
    }
    Last edited by Sytematic; 14 Dec 2010, 08:31. Reason: title was misleading

    #2
    We're not reproducing this issue - we wrapped your test code in an entry point as follows:
    Code:
    public class HiddenItemIssue implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            LoginForm f = new LoginForm("dummy/targetURL");
            f.draw();
            
    
        }
        private class LoginForm extends DynamicForm {
            private String credentialsURL;
    
            public LoginForm(String credentialsURL) {
                this.credentialsURL = credentialsURL;
                HiddenItem hostname = new HiddenItem("hostname");
                String s = "someHostname";
                hostname.setValue(s);
                String x = (String) hostname.getValue();
            
                TextItem textItem = new TextItem("username");
                textItem.setTitle("Username");
                textItem.setTitleOrientation(TitleOrientation.LEFT);
    
                PasswordItem passwordItem = new PasswordItem("password");
                passwordItem.setTitle("Password");
                passwordItem.setTitleOrientation(TitleOrientation.LEFT);
    
                ButtonItem buttonItem = new ButtonItem("Login");
                buttonItem.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent clickEvent) {
                        doLogin();
                    }
                });
                setFields(hostname, textItem, passwordItem, buttonItem);
    
            }
    
            public void doLogin() {
                RPCRequest request = new RPCRequest();
                request.setContainsCredentials(true);
                request.setActionURL(credentialsURL);
                request.setUseSimpleHttp(true);
                request.setShowPrompt(false);
                Map<String, String> params = new HashMap<String,String>();
                params.put("j_username", getValueAsString("username"));
                params.put("j_password", getValueAsString("password"));
                params.put("j_hostname", getValueAsString("hostname"));
    
                SC.logWarn(params.toString());
                request.setParams(patrams);
                RPCManager.sendRequest(request);
            }
        }
    }
    On loading the page, entering dummy values into the two visible fields and hitting send request, you can see the full map (including the hostname field value) logged in the developer console. The submit of course creates a 404 error but you can view the contents of the request in the RPC tab of the developer console and see that all 3 params were present.

    It's possible that the issue has been resolved since the 13th - we'd recommend trying again with the most recent nightly build and if you continue to see the issue, something else must be going on - the best thing to do would be to put together a simple standalone test case we can run on our end that demonstrates the issue. Also let us know what browser / OS you're seeing this behavior on.

    Thanks
    Isomorphic Software
    Last edited by Isomorphic; 27 Dec 2010, 14:46.

    Comment

    Working...
    X