This topic is locked

Is there a way to hide text field values

9/11/2025 3:30:10 PM
ASPRunner.NET General questions
M
MSchell author

I have a page with several text labels, based on selected option, I need to hide some of these fields. I'm able to hide database fields and labels, the code below works for everything but the text3 field, no errors, just doesn't work.

const fieldsToHide = ["VPName", "VPEmail", "VPUserID", "VPTitle", "VPApprovalDate", "VPApproval", "PositionNumber",
"MailUnit", "Jobcode", "SupvName", "SupvPositionNumber", "JobTitle", "JobStepIfUnion", "NewAnnualSalary", "NewHourlySalary",
"PositionNumber", "MailUnit", "Jobcode", "SupvName", "SupvPositionNumber", "JobTitle", "JobStepIfUnion", "NewAnnualSalary", "NewHourlySalary","CompanyEntityCode","text3"]
fieldsToHide.forEach(field => pageObj.hideField(field));

ChatGPT 9/11/2025

It looks like you're trying to hide a field named text3 along with other fields in your ASPRunner.NET application, but it seems that the text3 field is not being hidden as expected. Here are some troubleshooting steps and suggestions to help you resolve the issue:

  1. Check Field ID: Make sure that the field ID used in the fieldsToHide array matches the actual ID of the text3 field in your ASPRunner.NET project. Field IDs are case-sensitive, so ensure that the spelling and casing are correct.


  2. Inspect the Page Object: Verify that pageObj is correctly referencing the page object and that it has been initialized properly. If pageObj is not defined or is pointing to the wrong context, the hideField method may not work as intended.


  3. Ensure Field is Rendered: Confirm that the text3 field is actually rendered on the page at the time you're trying to hide it. If the field is conditionally rendered based on other criteria, it may not be available in the DOM when your code executes.


  4. Debugging Output: Add some debugging output before the hideField call to check if the text3 field is included in the fieldsToHide array and that the loop is being executed correctly. For example:

     console.log("Hiding fields:", fieldsToHide);
    fieldsToHide.forEach(field => {
    console.log("Hiding field:", field);
    pageObj.hideField(field);
    });

  5. Check for Errors: Open the browser's developer console (usually F12) and check for any JavaScript errors that might be occurring when you attempt to hide the fields. Sometimes, errors earlier in the script can prevent later code from executing.


  6. Manual Hide Test: Try manually hiding the field using the developer console to see if it works outside of your script. For example, you can execute a command like:

     pageObj.hideField('text3');
  7. Page Load Timing: If your script is running before the page is fully loaded, the text3 field might not be ready to be hidden. Ensure that your code runs after the page has fully loaded. You can use an event listener like window.onload to ensure this:

     window.onload = function() {
    const fieldsToHide = [...]; // your fields
    fieldsToHide.forEach(field => pageObj.hideField(field));
    };

  8. Field Type: If text3 is a special type of field (like a custom control or a non-standard input), ensure that the hideField method is compatible with it.



By following these steps, you should be able to diagnose why the text3 field is not being hidden as expected and make the necessary adjustments to your code. If you still have issues, consider providing more context or details about the text3 field and its configuration in your application.

M
MSchell author 9/12/2025

Can't make it work with AI stuff

I'd like to know how to hide a text label, from a simple add text on the Design page, and hide it based on a selected option.

I also looked at trying to make a section with text labels, then hide the section, but can't get that to work either