Skip to content

PasswordField Value property isn't updated in R2024a web app #79

@maxsaseg

Description

@maxsaseg

It seems like the onPasswordChanged function isn't triggered in a web app compiled in R2024a and thus the 'Value' property is never updated and returns "".
It works running from Matlab and when compiled to standalone and as web app in R2022b.
Please find a small example below copy from from app designer.

BR Max

`classdef app1 < matlab.apps.AppBase

% Properties that correspond to app components
properties (Access = public)
	UIFigure                  matlab.ui.Figure
	GridLayout                matlab.ui.container.GridLayout
	LoginGrid                 matlab.ui.container.GridLayout
	BrugernavnEditField       matlab.ui.control.EditField
	BrugernavnEditFieldLabel  matlab.ui.control.Label
	KodeordEditFieldLabel     matlab.ui.control.Label
	LoginButton               matlab.ui.control.Button
	KodeordEditField          wt.PasswordField
end

% Callbacks that handle component events
methods (Access = private)

	% Button pushed function: LoginButton
	function LoginButtonPushed(app, event)
		userPw = app.KodeordEditField.Value;

		if  userPw == ""
			userPw = "EmptyPW";
		end

		uialert(app.UIFigure, sprintf('User pw: %s', userPw), 'Bruger Pasord')
		
	end
end

% Component initialization
methods (Access = private)

	% Create UIFigure and components
	function createComponents(app)

		% Create UIFigure and hide until all components are created
		app.UIFigure = uifigure('Visible', 'off');
		app.UIFigure.Position = [100 100 640 480];
		app.UIFigure.Name = 'MATLAB App';

		% Create GridLayout
		app.GridLayout = uigridlayout(app.UIFigure);
		app.GridLayout.ColumnWidth = {'1x', '1x', '1x'};
		app.GridLayout.RowHeight = {'1x', '1x', '1x', '1x', '1x', '1x', '1x', '1x'};

		% Create LoginGrid
		app.LoginGrid = uigridlayout(app.GridLayout);
		app.LoginGrid.ColumnWidth = {85, 81, 150, 100};
		app.LoginGrid.RowHeight = {22, 22, 19, 22, 27, 50, 22, 17};
		app.LoginGrid.ColumnSpacing = 6.8;
		app.LoginGrid.Padding = [6.8 10 6.8 10];
		app.LoginGrid.Layout.Row = [1 5];
		app.LoginGrid.Layout.Column = [1 3];

		% Create KodeordEditField
		app.KodeordEditField = wt.PasswordField(app.LoginGrid);
		app.KodeordEditField.Layout.Row = 2;
		app.KodeordEditField.Layout.Column = [2 4];

		% Create LoginButton
		app.LoginButton = uibutton(app.LoginGrid, 'push');
		app.LoginButton.ButtonPushedFcn = createCallbackFcn(app, @LoginButtonPushed, true);
		app.LoginButton.BusyAction = 'cancel';
		app.LoginButton.Interruptible = 'off';
		app.LoginButton.Layout.Row = 7;
		app.LoginButton.Layout.Column = 4;
		app.LoginButton.Text = 'Login';

		% Create KodeordEditFieldLabel
		app.KodeordEditFieldLabel = uilabel(app.LoginGrid);
		app.KodeordEditFieldLabel.Layout.Row = 2;
		app.KodeordEditFieldLabel.Layout.Column = 1;
		app.KodeordEditFieldLabel.Text = 'Password';

		% Create BrugernavnEditFieldLabel
		app.BrugernavnEditFieldLabel = uilabel(app.LoginGrid);
		app.BrugernavnEditFieldLabel.HorizontalAlignment = 'right';
		app.BrugernavnEditFieldLabel.Layout.Row = 1;
		app.BrugernavnEditFieldLabel.Layout.Column = 1;
		app.BrugernavnEditFieldLabel.Text = 'Brugernavn';

		% Create BrugernavnEditField
		app.BrugernavnEditField = uieditfield(app.LoginGrid, 'text');
		app.BrugernavnEditField.Layout.Row = 1;
		app.BrugernavnEditField.Layout.Column = [2 4];

		% Show the figure after all components are created
		app.UIFigure.Visible = 'on';
	end
end

% App creation and deletion
methods (Access = public)

	% Construct app
	function app = app1

		% Create UIFigure and components
		createComponents(app)

		% Register the app with App Designer
		registerApp(app, app.UIFigure)

		if nargout == 0
			clear app
		end
	end

	% Code that executes before app deletion
	function delete(app)

		% Delete UIFigure when app is deleted
		delete(app.UIFigure)
	end
end

end`

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions