• Resolved peteincali2103

    (@peteincali2103)


    Hi, I was wondering if it is possible to make a custom attribute required. I added the code to form.php

    <label for="event_short_description"><?php _e('Short Description (Max 120 characters)','emefs'); ?> <small><?php _e('required','emefs'); ?></small></label><br />
    			<?php // EMEFS::attribute('short_desc'); ?>
    	        <input id="short_desc" name="event_attributes[short_desc]" value="" type="text" maxlength="120">
    			<?php EMEFS::error('short_desc'); ?>

    which works except that the field is not being validated.

    Thanks!

    https://www.ads-software.com/plugins/events-made-easy-frontend-submit/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Franky

    (@liedekef)

    Just add ‘required=”required”‘ to your input field.

    Hello Franky, that sounds ok, But where can i find the inputfield for default form.

    For example in default form you see:

    <h3><?php _e('Location Information','emefs'); ?></h3>
    
    		<div class="input">
    			<label for="location_name" ><?php _e('Name','emefs'); ?> <small> <?php _e('required','emefs'); ?></small></label>
    			<?php EMEFS::field('location_name'); ?>
    			<?php EMEFS::error('location_name'); ?>
    		</div>

    How can i set “Location_name” as required?

    Looking now for 2 hours and can’t find it ??

    Plugin Author Franky

    (@liedekef)

    Try this:

    EMEFS::field('location_name','text','required="required"');

    Maybe I should make this easier …

    Thanks, i tried that, but it seems not to work.

    <div class="input">
    			<label for="location_name" ><?php _e('Name','emefs'); ?> <small> <?php _e('required','emefs'); ?></small></label>
    			<?php EMEFS::field('location_name','text','required="required"'); ?>
    			<?php EMEFS::error('location_name'); ?>
    		</div>

    This is the code i used but there was no check for validating. While it did for the normal requered fields, like startdate and ‘event name’

    Hope you have an other suggestion?

    thanks anyway,
    greetings from holland.

    Plugin Author Franky

    (@liedekef)

    Well, the required attribute only works on html5-capable browsers (and apparently not on safari).
    If that is not sufficient, you can use jquery to force the field to be non-empty before submitting the form.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Extra Attributes make required field’ is closed to new replies.