This topic is locked
[SOLVED]

 hide column (or field) based on dropdown selection

5/19/2011 4:22:57 AM
PHPRunner General questions
R
roadyx author

HI, can someone assist please?

  1. hide column (or field) based on dropdown selection (in the add page)
    2)also, based on dropdown selection, i would like to be able to change a regex validation pattern based on drop-down selection...
    Thanks!

R
roadyx author 5/21/2011



Here are two helpful articles:

http://www.asprunner...-editadd-pages/

http://xlinesoft.com...ascript_api.htm


Thanks Jane, this was really helpful.
For other users two ways to do this:

  1. Hide the entire row
  2. Hide the field
    Here's a snippet for others:
    on HTML editor view:

    On the row you want to hide

    Example: {BEGIN acode_fieldblock}<TRid=acoderow>
    Javascript snippet:
    // dropdown control

    var ctrlMrchntid = Runner.getControl(pageid, 'mrchntid');

    // target field to appear/disappear

    var ctrlAcode = Runner.getControl(pageid, 'acode');

    //target row to appear / disappear

    var acoderow = document.getElementById("acoderow");
    ctrlMrchntid.on('change', function(e){

    if (this.getValue() == 'TESTVAL')

    {

    // choose whether you want field or entire row

    //ctrlAcode.show();

    acoderow.style.display = '';

    }else{

    // choose whether you want field or entire row

    //ctrlAcode.hide();

    acoderow.style.display = 'none'; }
    }

    );