Hide Form fields based on condition

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
vintoICT
User
Posts: 407

Hide Form fields based on condition

Post by vintoICT »

In my form I have a field named Asset type (Select ). It could be car, building etc.
I want to display form fields ,plate number,Make , and Model all input text. If the the assest type is Car. Pls note I understand dynamic selection. This is different. I want the whole form field hidden if Car is not selected . Thanks


mobhar
User
Posts: 11726

Post by mobhar »

You may write jQuery or Javascript code in Startup Script under Client Scripts -> Table-Specific -> Add/Copy Page and/or Edit Page to hide your desired fields based on your business-logic.


arbei
User
Posts: 9384

Post by arbei »

You may use Client Side Events, see Field Setup -> Client side events (for Add/Copy/Edit/Search) in the help file.


vintoICT
User
Posts: 407

Post by vintoICT »

This is working :

// Write your table-specific startup script here, no need to add script tags.
$("#x_Category_Temp").change(function() {
    if ($(this).val() == "Motor Vehicle") {
        $('#x_Make').show();
       
    } else {
        $('#x_Make').hide();
       
    }
});
$("#x_Category_Temp").trigger("change");

i just need to add the id for label . Thank you


Post Reply