I've been doing some research and adding the "required" indicator to the inputs placeholder is becoming increasingly popular and it is cross browser supported. This of course excludes selects, radio and check-boxes.
Surprisingly IMO, it actually looks really nice and eliminates the line breaks on smaller devices.
Maybe Chris (DrByte) can weigh in as if there is future plans for the "placeholder attribute" or if at some point it will get added to the functions parameters.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
So I've worked out how to do this in tel_contact_us_default.php:
But for the other files that have required fields I'm stuck. e.g. in tpl_modules_create_account.php:Code:<label class="inputLabel" for="contactname"><?php echo ENTRY_NAME . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label> <?php echo zen_draw_input_field('contactname', $name, ' size="40" id="contactname"'); ?> <br class="clearBoth" />
If I do the following:Code:<label class="inputLabel" for="firstname"><?php echo ENTRY_FIRST_NAME; ?></label> <?php echo zen_draw_input_field('firstname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' id="firstname"') . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?> <br class="clearBoth" />
it breaks the form and nothing is displayed.Code:<label class="inputLabel" for="firstname"><?php echo ENTRY_FIRST_NAME . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>'; ?></label> <?php echo zen_draw_input_field('firstname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' id="firstname"') : ''); ?> <br class="clearBoth" />
My PHP and HTML knowledge was good enough to make my own template for use in 1.3.x and up, but I'm stuck now!
Andy
My suggestion was to add the "required" indicator to the inputs placeholder.
A demo of what I mean can be seen here and the files can be downloaded via git
If your looking to move the "required" indicator to the right side of the label then copy what was done on the text area field on the contact us page. It's just an indicator and has no affect over validation nor do the constants need the "null" statement.
PHP Code:
<label for="enquiry"><?php echo ENTRY_ENQUIRY . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?></label>
See also this thread
https://www.zen-cart.com/showthread....ds-Fluid-Forms
Great work guys!!
Just for general information if someone is looking through the plugins for this template: There is a template by the same name "Responsive Classic" (see https://www.zen-cart.com/downloads.php?do=file&id=1816 ) which is NOT related to this template. So if anyone downloads that older plugin, it is NOT the same as the template discussed in this thread.
Bookmarks