Fork me on GitHub

Setting input id's manually and pnAPI...possible to coexist?  Bottom

  • I'm using the first block of code for a "Sender Name" input...and it works fine. The issue is with W3C validation. It seems that PostNuke sets the id attribute for you automatically by copying the name attribute before the HTML is output, as seen in the second block below. The problem is that XHTML 1.0 will not validate with brackets in the id attribute...so I'm wondering: can I set the input id's manually? I could go back and recode it "around" this, but I'd prefer to keep the array, as it allows for more rapid expansion of the form at the code level.

    Code

    // INPUT FOR SENDER'S NAME
    $Sender_Name = $Contact['Sender_Name'];
    ...blah blah...
    $row = array();
    $output->SetOutputMode(_PNH_RETURNOUTPUT);
    $row[] = $output->BoldText(_ALAR_YOUR_NAME);
    $row[] = $output->FormText('Contact[Sender_Name]', $Sender_Name, 35, 50);
    $output->SetOutputMode(_PNH_KEEPOUTPUT);
    $output->TableAddrow($row, 'left', 'middle');


    Code

    <input type="text" name="Contact[Sender_Name]" id="Contact[Sender_Name]" value="" size="35" maxlength="50" tabindex="1" />


    The form is designed to preserve state if a user toggles between the long/short forms...hence the "circular" var setting...but again, this already works great...I'm just trying to clean up the validation issues by setting my own input id's.

    Can I do it via pnAPI...or would it entail $output->Text('Hand code the input here');

    Thanks for any assists!
  • 0 users

This list is based on users active over the last 60 minutes.