Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PString PHTTPBooleanField::GetHTMLInput ( const PString input ) const [virtual]

Convert the field input to HTML for inclusion into the HTTP page.

Reimplemented from PHTTPField.

Definition at line 1420 of file httpform.cxx.

References PRegularExpression::Extended, PString::FindRegEx(), PRegularExpression::IgnoreCase, and PString::Mid().

{
  static PRegularExpression checkboxRegEx("type[ \t\r\n]*=[ \t\r\n]*\"?checkbox\"?",
                                          PRegularExpression::Extended|PRegularExpression::IgnoreCase);
  if (input.FindRegEx(checkboxRegEx) != P_MAX_INDEX) {
    PCaselessString text;
    PINDEX before, after;
    if (FindInputValue(input, before, after)) 
      text = input(0, before) + "TRUE" + input.Mid(after);
    else
      text = "<input value=\"TRUE\"" + input.Mid(6);
    SpliceChecked(text, value);
    return "<input type=hidden name=\"" + fullName + "\">" + text;
  }

  static PRegularExpression radioRegEx("type[ \t\r\n]*=[ \t\r\n]*\"?radio\"?",
                                       PRegularExpression::Extended|PRegularExpression::IgnoreCase);
  if (input.FindRegEx(radioRegEx) != P_MAX_INDEX) {
    PINDEX before, after;
    if (FindInputValue(input, before, after)) {
      PCaselessString text = input;
      PString val = input(before+1, after-1);
      SpliceChecked(text, (value && (val *= "TRUE")) || (!value && (val *= "FALSE")));
      return text;
    }
    return input;
  }

  return PHTTPField::GetHTMLInput(input);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index