Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Move location of red required asterisk in form?

osTicket v1.9.8.1

I'd like to move the required red asterisk in the form to the right of the field label colon ( Full Name: * ) instead of after the box. I've tried hacking the dynamic-form.tmpl.php page by moving line 33, but then all the fields have the asterisk, even if they're not required. Anybody have a fix?

Thanks!

<?php
    // Form headline and deck with a horizontal divider above and an extra
    // space below.
    // XXX: Would be nice to handle the decoration with a CSS class
    ?>
    <tr><td colspan="2"><hr />
    <div class="form-header" style="margin-bottom:0.5em">
    <h3><?php echo Format::htmlchars($form->getTitle()); ?></h3>
    <em><?php echo Format::htmlchars($form->getInstructions()); ?></em>
    </div>
    </td></tr>
    <?php
    // Form fields, each with corresponding errors follows. Fields marked
    // 'private' are not included in the output for clients
    global $thisclient;
    foreach ($form->getFields() as $field) {
        if (!$field->isVisibleToUsers())
            continue;
        ?>
        <tr>
            <?php if ($field->isBlockLevel()) { ?>
                <td colspan="2">
            <?php
            }
            else { ?>
                <td><label for="<?php echo $field->getFormName(); ?>" class="<?php
                    if ($field->get('required')) echo 'required'; ?>">
                <?php echo Format::htmlchars($field->get('label')); ?>:</label></td><td>
            <?php
            }
            $field->render('client'); ?>
            <?php if ($field->get('required')) { ?>
                <font class="error">*</font>
            <?php
            }
            if ($field->get('hint') && !$field->isBlockLevel()) { ?>
                <br /><em style="color:gray;display:inline-block"><?php
                    echo Format::htmlchars($field->get('hint')); ?></em>
            <?php
            }
            foreach ($field->errors() as $e) { ?>
                <br />
                <font class="error"><?php echo $e; ?></font>
            <?php }
            $field->renderExtras('client');
            ?>
            </td>
        </tr>
        <?php
    }
?>

Comments

  • This is a pretty old version, I doubt that you will get much traction from people on this.
  • Thanks for the reply, ntozier. I should have posted this in the v1.9 section.  My mistake. Can you please move it there? I realize it's an old version, but it works and has been highly modified, so would prefer to just hack away if possible. Also, I'm not the only one clinging to an old version for one reason or another, check out Softaculous https://www.softaculous.com/support/index.php
  • Moved. :)
  • edited April 17
    I just deleted line 33 for now since the required fields have an alert on validation anyway -
    <font class="error">*</font>

    Not perfect, but at least the form looks cleaner than having the red asterisks floating at the end of the boxes with no visual connection to the field labels. :-|

Sign In or Register to comment.