This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Submit Button 2.0g


  1. CyberSpy
    Member

    Hi Yuniar,
    I'm working on a form, using the latest build of 2.0g. I am trying to replace the text style submit button with an image, and the old way of doing it (in view_functions.php) isn't working. So at the end of my CSS for that form, I put:

    #saveForm{
    	background-image: url('/images/submit.gif');
            border:0px
            height:14px
            width:84px
    }

    And what that does it put the image very distorted on top of a text style block. What am I leaving out? With the newer builds, what is the detailed procedure for make the submit button an image?

    Thanks in advance
    CS

    Posted 16 years ago #
  2. redityo

    Hi ...

    You can try to edit view-functions.php on line 1766, change type="submit" to type="image" and add "src" properties relative to your image path

    <input id="saveForm" class="button_text" type="image"
    src="images/exec.png" name="submit" value="{$button_text}" />

    MachForm Support

    Posted 16 years ago #
  3. CyberSpy
    Member

    That's what I initially did, it shows the text submit, not the image. That's why I asked if it's all done through CSS now.

    Line 1759 reads:

    <input id="saveForm" class="button_text" type="image" src="/images/submit.gif" name="submit" value="{$button_text}" />

    Posted 16 years ago #
  4. redityo

    Hi ..

    Where's you save the image ? is it on machform "image" folder ? try to change

    src="/images/submit.gif"

    to

    src="images/submit.gif"

    it's work for me... to make sure your relative path is right, you can right click the submit bottom and see the properties of your image.


    MachForm Support

    Posted 16 years ago #
  5. CyberSpy
    Member

    I found something interesting. If I look at the form standalone, it works. If I use the IFrame include, it works, but when I use advanced embed (which I prefer) it doesn't work with the php require.

    I really detest using Iframes, and the Iframe method used by Machform isn't W3 compliant. This is why I wanted to do it via CSS.

    Posted 16 years ago #
  6. redityo

    I see .. the problem occurs when you use advanced embed. Since advance embed use different process with embed / view method, this can be fixed by editing line 2096 with the same modification as on line 1759 :

    $submit_button = '<input type="hidden" name="submit" value="1" />'."\n".
    '<input id="saveForm" class="button_text" type="image" src="images/exec.png"
    name="submit" value="'.$lang['submit_button'].'" />';

    and I have try to edit the CSS it can not give the best result either.


    MachForm Support

    Posted 16 years ago #
  7. CyberSpy
    Member

    What changes on 2096? (which is now a blank line from previous changes, so the line numbers have moved up or down a line or two) what am I changing from and to?

    P.S. Thank you for all of your help redityo

    Posted 16 years ago #
  8. redityo

    it's glad to help you ..

    You can search around line 2093 ~ 2098 on "view-functions.php" and make change from :

    $submit_button = '<input type="hidden" name="submit" value="1" />'."\n".
    '<input id="saveForm" class="button_text" type="submit"
    name="submit" value="'.$lang['submit_button'].'" />';

    to

    $submit_button = '<input type="hidden" name="submit" value="1" />'."\n".
    '<input id="saveForm" class="button_text" type="image" src="images/exec.png"
    name="submit" value="'.$lang['submit_button'].'" />';

    MachForm Support

    Posted 16 years ago #
  9. georgechoi
    Member

    Hi,

    What if I need different buttons styles (or images) for different websites I'll be designing? It'll be great if there are any ways we can easily update the submit button style for different forms without changing any codes at all (included in the WYSIWYG).

    Posted 14 years ago #
  10. redityo

    Hi,

    Is each website use different form ? for example website A using form 1 and website B using form 2 ? if so, you can try to use the method that posted in here :

    http://www.appnitro.com/forums/topic/change-the-submit-button?replies=4#post-6804

    in there you'll find these code :

    if ($_GET['id'] == 6) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="images/exec.png" name="submit" value="'.$button_text.'" />';
    }
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }

    you can use your form ID to put different image on each form.
    However to change the button style (not images), its quite easier. Simply edit and change these CSS code on each form :

    /**** Buttons ****/
    #main_body input.button_text
    {
    	overflow:visible;
    	padding:0 7px;
    	width:auto;
    }

    MachForm Support

    Posted 14 years ago #
  11. vern1271
    Member

    OK, Id id this but it seems to not work with the advanced form code option. If I select view form from within MachForm it works. How do I get it to work using the advanced code option?

    Posted 14 years ago #
  12. yuniar

    I assume you are doing modification from this post:
    http://www.appnitro.com/forums/topic/change-the-submit-button?replies=4#post-6804

    If that is the case, the post above only works for the standard form not advanced.
    To make it work for advanced code, search for the similar code on another lines.

    Search around line 2094 - 2099. The modification is the same.


    MachForm Founder

    Posted 14 years ago #
  13. vern1271
    Member

    Yuniar, I found this...

    if(!empty($form->review) && !$show_password_form){
    $submit_button = '<input type="hidden" name="submit_continue" value="1" />'."\n".'<input id="saveForm" class="button_text" type="submit" name="submit_continue" value="'.$lang['continue_button'].'" />';
    }else{
    $submit_button = '<input type="hidden" name="submit" value="1" />'."\n".'<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$lang['submit_button'].'" />';
    }
    }

    I tried adding this...

    if ($_GET['id'] == 16) {
    $button_code = '<input id="saveForm" class="button_text" type="image" src="images/lp-button.gif" name="submit" value="'.$button_text.'" />';
    } else {
    $button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }

    And I updated {$submit_button} with {$button_code} as well. Didn't work. Any help would be appreciated.

    Posted 14 years ago #
  14. yuniar

    Hi Vern,

    Can you send us your file please? Also the link to the page where you put the form.
    Mail to: customer.service [at] appnitro.com

    We'll check it further.


    MachForm Founder

    Posted 14 years ago #
  15. msfbiz
    Member

    For those who wonder, I managed to make it work with the advanced embed by changing the first line of code from

    if ($_GET['id'] == 6) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="images/exec.png" name="submit" value="'.$button_text.'" />';
    }
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }

    to

    if ($form_id == 6) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="images/exec.png" name="submit" value="'.$button_text.'" />';
    }
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }

    With the advanced embed, there's no 'id' variable in the url for $_GET to work.

    Hope this helps,
    Mike

    Posted 14 years ago #

RSS feed for this topic

Reply