Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Tutorials
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Using validation in interactive Ui textbox

Solved588 views30th September 2024
3
Aditiben Desai [DevOps Member]372 11th June 2024 2 Comments

Hello,
I am building an interactive UI and I want to add validation to a textbox which should match specific patterns. If the user input doesn't match the pattern then UI should declare it as invalid state and show some tooltip to guide the user.

Need some guidance on how i can add it in interactive UI.

Thanks and Regards,

Aditi.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 30th September 2024
Marieke Goethals [SLC] [DevOps Catalyst] commented 27th August 2024

I see that this question has been inactive for some time. Do you still need help with this? If not, could you select the answer (using the ✓ icon) to indicate that the question is resolved?

Marieke Goethals [SLC] [DevOps Catalyst] commented 30th September 2024

As this question has now been inactive for a long time, I will close it. If you still want more information about this, could you post a new question?

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
2
Robin Meurisse [SLC] [DevOps Enabler]1.12K Posted 12th June 2024 2 Comments

Hi Aditi,

One way of achieving this result would be to add an extra 'Label' to the dialog where you present to the user if the input is valid or invalid. This extra label will then serve as a status for your input validation.

Example:

// Initialize dialog with a textbox and label serving as status validation
Label labelInfoUserInput = new Label("User Input:");
TextBox textBoxInput = new TextBox();
Label labelStatusInput= new Label(String.Empty);

AddWidget(labelInfoUserInput , row, 0);
AddWidget(textBoxInput, row, 1);
AddWidget(labelStatusInput, row, 2);

When the user updates the value within your TextBox, validate the new data by listening to the Changed event and update the status label.

Example:

textBoxInput.Changed += TextInputChanged;

private void TextInputChanged(object sender, TextBox.TextBoxChangedEventArgs e)

{
Regex regex = new Regex("*"); // update pattern to match
if (!regex.IsMatch(e.Value))
{
labelStatusInput.Text = "Invalid input!";
}
else
{
labelStatusInput.Text = "Input: OK";
}
}

Would this be a viable option for your use case?

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 30th September 2024
Aditiben Desai [DevOps Member] commented 12th June 2024

Hi, I have added below code for testing purpose. Can you let me know where I can add data to listen those change in textbox :
class script{
public void Run(Engine engine){
controller = new InteractiveController(engine);
InputParams inputDialog = new InputParams(engine);

string serviceName = inputDialog.serviceNameTb.Text;

}

public class InputParams : Dialog
{
public Label LbiErrorInput = new Label(string.Empty);

private readonly Label serviceNameLabel = new Label(“Service Name: “);

public InputParams(Engine engine) : base(engine)
{

//Service Name Tb
serviceNameTb = new TextBox
{
Width = 250,
};

// Define layout

AddWidget(serviceNameLabel, 3, 0);
AddWidget(serviceNameTb, 3, 1);

AddWidget(LbiErrorInput, 6, 0);

}
public TextBox serviceNameTb { get; set; }
}

Robin Meurisse [SLC] [DevOps Enabler] commented 13th June 2024

Hi Aditiben,

It’s possible to define that listener where you initialized the dialog within your run method.
Or create a small ‘Presenter’ class according to the Model-View-Presenter pattern to abstract the view from the presenting logic.

The result could be something like this:
public void Run(IEngine engine)
{
controller = new InteractiveController(engine);
InputParams inputDialog = new InputParams(engine);
InputParamsPresenter presenter = new InputParamsPresenter(inputDialog);

inputDialog.BtnConfirm.Pressed += (sender, args) =>
{
if (presenter.ValidateServiceName(inputDialog.ServiceNameTb.Text))
{
// Valid service name -> perform next actions
// Eg. controller.Run(nextDialog);
var progressDialog = new ProgressDialog(engine) { Title = “Result” };
progressDialog.OkButton.Pressed += (o, eventArgs) => engine.ExitSuccess(“OK”); // Make sure the OK button does something
progressDialog.AddProgressLine(“Resulting service name: ” + inputDialog.ServiceNameTb.Text);
controller.ShowDialog(progressDialog); // show this dialog to the user instead
}
};

controller.Run(inputDialog);
}

public class InputParams : Dialog
{
private readonly Label serviceNameLabel = new Label(“Service Name: “);

public Label LbiErrorInput { get; } = new Label(string.Empty);

public TextBox ServiceNameTb { get; } = new TextBox { Width = 250 };

public Button BtnConfirm { get; } = new Button(“Confirm”);

public InputParams(IEngine engine) : base(engine)
{
// Define layout
AddWidget(serviceNameLabel, 3, 0);
AddWidget(ServiceNameTb, 3, 1);

AddWidget(LbiErrorInput, 6, 0);
AddWidget(BtnConfirm, 7, 0);
}
}

public class InputParamsPresenter
{
private readonly InputParams dialog;

public InputParamsPresenter(InputParams dialog)
{
this.dialog = dialog;

// Define events
dialog.ServiceNameTb.Changed += ServiceNameTbOnChanged;
}

public bool ValidateServiceName(string serviceName)
{
Regex regex = new Regex(“*”); // update pattern to match
if (!regex.IsMatch(serviceName))
{
dialog.LbiErrorInput.Text = “Invalid input!”;
return false;
}
else
{
dialog.LbiErrorInput.Text = “Input: OK”;
return true;
}
}

private void ServiceNameTbOnChanged(object sender, TextBox.TextBoxChangedEventArgs e)
{
ValidateServiceName(e.Value);
}
}

You are viewing 1 out of 1 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas

Recent questions

How to implement bearer token refresh? 0 Answers | 0 Votes
Web Applications exception in Cube due to invalid certificate 0 Answers | 0 Votes
Redundancy Groups and Alarming – Duplicate Alarms 0 Answers | 0 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (109) Correlation (69) Correlation rule (52) Cube (151) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin