Tagged: , , ,

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #825213

    Hello, I would like to add an icon to the form submit button like a normal enfold button element.

    I have tried adding HTML to submit label field, but HTML doesn’t work in that field. I tried adding a short code in and it failed as well.

    Any suggestions?

    #826840

    Hey talawar,
    I was going to suggest using the shortcode wand in the default editor, but I think you have tried that?
    Could you link to the form so we can see?
    postimage
    postimage

    Best regards,
    Mike

    #828413

    You are correct Mike, I tried that. The shortcode won’t save in that form. It is just a basic form nothing special about it. I can’t link it because it is in dev behind a firewall. I decided the design could let this one go. I figured I could edit the theme’s PHP file for the form, but that isn’t in my client’s budget. I was hoping for some kind of filter in the themes function file or some kind of CSS trick that would be a quick fix.

    I saw a couple forum posts about adding it as a BG image, but that just seemed too sloppy for my taste.

    I was thinking there would be a function that could disable the escaping of the HTML for that one field in the form options template, that would allow me to insert the plain HTML markup.

    • This reply was modified 7 years, 5 months ago by talawar. Reason: Grammatical error
    #828476

    well we have on contact form that element : input.button[type="submit"] maybe it is possible to prepend some code to that element and style it later via quick css

    #828508

    if we know the html attribute symbol for that icon you can insert it in the input field of contact form element f.e.:

     Submit

    you only have to setup then :

    input.button[type="submit"] {
        font-family: entypo-fontello;
    }

    but is there a list of that html attribut symbols concerning to entypo-fontello icons ?

    #828548

    I ended up editing the parent theme… framework/php/class-form-generator.php

    Line 322
    Replace the <input> tag with <button>HTML that to display</button> leave all of the

    The <input> is just too limited to work with using jQuery or Javascript. The value=”” attribute doesn’t do well with HTML.

    I found the easiest way to get the desired HTML ( a button with an icon ) with the minimal CSS styling adjustments, was to inspect an existing button in the chrome debug window.

    Copy the element at this parent div: <div class="avia-button-wrap avia-button-center el_after_av_hr avia-builder-el-last main_btn">
    Remove the identifying class e.g. “avia-builder-el-48″ if your choose to”
    The I removeded the href="" and change the <a> tags to <span> tags.

    One draw back that I haven’t solved is that the page will now refresh on “SUBMIT.” I don’t feel it is essential to this project but it would be nice to figure this out for the future. It is a bummer that I will have to update the parent everytime…

    I used the following CSS to stop the unwanted styling effects:

    
    .avia_ajax_form .button {
        margin: 0;
        padding: 0;
        border-radius: 2px;
        border-bottom-width: 0;
        border-bottom-style: none;
        font-weight: 700;
        font-size: 0.92em;
        min-width: 142px;
        outline: none;
    }
    .main_color .button:hover {
    background:white;
    }
    

    Finally I added a class, “someclass”, after class="avia_iconbox_title someclass" like this to finish the styling.

    #828653

    how do i get that little sign in source code : data-av_icon=''

    there must be a conversion from array icon and icon-select to that sign.

    i think of making an edited contact.php shortcode with icon select but that display_char generates me a whole bunch of html.

    #828664

    @Guenni007 if you are asking how I added the symbol I want to the framework PHP, the simple answer is I copy and paste it.

    For example the code below gives me the right arrow icon:
    <span class="avia_button_icon avia_button_icon_right" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span>

    In order to get the code above in the first place, I create a normal button or stand alone inline icon. Then I “publish/preview” the page. Inspect the icon with the debugger and copy the element.

    The problem is that the icon character (the square gylph), data-av_icon="" isn’t found until enfold runs it through its fontello code, so that is the easiest way to figure out the proper value for data-av_icon="".

    #828678

    no that is not what i want – i told here https://kriesi.at/support/topic/adding-an-icon-to-the-form-submit-button/#post-828508 that this will be the fastest way to get an entypo-fontello icon to the submit button – you only have to put in that field the copied sign plus Submit text and set up css for font-family than.
    red arrows

    click to enlarge

    but i want to edit the shortcode to have the oportunity to have icons for that button looks this way newfields with blue arrows

    but inserting in that input field the "{$display_char}"." ".$button ends up ( see preview in image above)
    that comes i think from a function in font-manager.class.php
    So if i knew how to get via php only the transformed sign  without that other stuff – i can insert than that glyph to value of input field.
    And share afterwards the edited contact.php

    #828684

    Now I see what you are saying. I still think you need to edit the framework file to make that input into a <button></button> tag. The form button field (RED ARROW from your image) is placed into <input type="submit" value="Submit <span class="avia_button_icon avia_button_icon_right" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span>"/>

    Am I correct in saying you are getting this: Submit <span class="avia_button_icon avia_button_icon_right" aria-hidden="true" data-av_icon="" data-av_iconfont="entypo-fontello"></span> instead of this Submit >.

    Again the root of the problem is trying to put HTML into a data-attribute, which we are limited to with an <input/> tag.

    This StackExchange answer may be what you are looking for https://stackoverflow.com/questions/5823835/html-in-the-input-field-value
    I tried replacing the brackets, but it still escaped the HTML.


    @Guenni007
    Your method would be far superior. Sidenote I always appreciate your answers! You definitely add some amazing solutions on this forum, I applaud your effort!

    • This reply was modified 7 years, 5 months ago by talawar.
    #828703

    The image above is two things in one.

    so to be clear: if you try only red arrows – that will work with that little css in quick css:

    input.button[type="submit"] {
        font-family: entypo-fontello;
    }

    but the thing is – that a handful of people will know how to copy/paste those glyphs from source code.
    i make a button with icon elsewhere and look to the source code. Copy paste that glyph : f.e and insert it in the submit field as:  Submit
    so this method only will work if we can offer f.e a table of fontello-icons with there code and with that glyphs.

    Or the other method for noobs – just edit the

    #828725

    the input button destroys every method i can imagine !

    For some reasons i tried it with embeding fontawesome (functions.php of child-theme) :

    add_action( 'wp_enqueue_scripts', 'enqueue_awesome' );
    function enqueue_awesome() {
      wp_enqueue_style( 'prefix-font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css', array(), '4.7.0' );
    }

    and than add the concerning class to the submit button:

    function add_class_to_submit() {
    ?>
    <script type="text/javascript">
       jQuery(document).ready(function() {
          jQuery('input.button').addClass('fa fa-envelope-open-o');
       });
     </script>
    <?php
    }
    add_action('wp_footer', 'add_class_to_submit', 20);

    this works but font isn’t visible – the pseudo-class before and after did not work

    #828726

    if i use prepend to input button – the inserted code goes between <input> and </input>

    function prepend_to_submit(){
    ?>
    <script>
    (function($){
        $('input.button[type="submit"]').prepend('<i class="fa fa-envelope-open-o"></i>');     
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'prepend_to_submit');

    it is in the source code but not visible on some reasons.
    right solution by entering in the enfold dialog Submit input field :  Submit

    left side fontawesome included but not visible
    https://webers-testseite.de/kokon/elements/contact-form/

    • This reply was modified 7 years, 5 months ago by Guenni007.
    #828728

    You can open the imgur links in a new ta to view the imgs.
    Submit button with debugger
    I replicated what you have done above.

    The icon is there, but I believe it will never appear with the <input> tags. This is why I had to resort to editing the framework PHP file to change it to a <button>.

    I feel like it is way more work to change the behavior of an HTML5 <tag> than to just use the correct <tag>.

    working icon submit button

    • This reply was modified 7 years, 5 months ago by talawar. Reason: Imgs not working
    #830883

    Hi,

    Another work around is to add an icon element or shortcode before or after the contact form, add the custom css attribute “form-icon” then use the following script in the functions.php file.

    // add submit icon
    function ava_custom_script_mod(){
    ?>
    <script>
    (function($){
    	var icon = $('.form-icon .av-icon-char').data('av_icon'),
    			submit = $('input[type="submit"]'),
    			value  = submit.attr('value');
    
    			submit.attr('value', icon + ' ' + value);
    			submit.css({
    				'font-family' : 'entypo-fontello'
    			});
    
    			$('.form-icon').css('display', 'none');
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'ava_custom_script_mod');

    Best regards,
    Ismael

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.