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

Change the 'Submit' button


  1. KnockOuts
    Member

    How do I change the submit button to be a graphic of my own on a particular form?

    Posted 14 years ago #
  2. redityo

    Hi,

    Check out this post

    http://www.appnitro.com/forums/topic/submit-button-20g#post-2833


    MachForm Support

    Posted 14 years ago #
  3. KnockOuts
    Member

    What if I need to change it for just a specific form?

    Posted 14 years ago #
  4. redityo

    You can add a form id condition in there, for example you need to change a submit button for form 6 only, then try to follow these steps :

    1. Go to line 1747 ~ 1751, you'll see these code :

    if(empty($form->review)){
    	$button_text = $lang['submit_button'];
    }else{
    	$button_text = $lang['continue_button'];
    }

    then put these code bellow that line

    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.'" />';
    }

    2. Go to line 1765 and you'll see this code

    <input id="saveForm" class="button_text" type="submit" name="submit" value="{$button_text}" />

    replace the code to be like this

    {$button_code}

    Don't forget to change the form id with yours


    MachForm Support

    Posted 14 years ago #
  5. georgechoi
    Member

    Hi, I'm not a php coder and I'm trying to have two different forms that will use the same button image as the submit button. I cannot get both forms to use to the same button (one form uses the standard submit button). Why is that?

    For example: if I want to add a custom button for form 6&7, I thought adding codes right after form 6 would work (but it didn't work), and here's what I added as an example:

    if ($_GET['id'] == 7) {
    $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.'" />';
    }

    Please help!! Thanks in advance.

    Posted 13 years ago #
  6. yuniar

    Simply change the "if" line, to be something like this:

    if (($_GET['id'] == 7) or ($_GET['id'] == 6)) {

    MachForm Founder

    Posted 13 years ago #
  7. georgechoi
    Member

    Thanks yuniar! I will give that a try.

    Posted 13 years ago #
  8. georgechoi
    Member

    Hi yuniar,

    I tried what you told me to do, but it doesn't work yet. I'm not sure I did incorrectly, but everything seems to be correct in the codes. (Please correct me if I'm wrong.)

    This is form 12:
    http://www.webdesigntouch.com/test/webdesigntouch/pricing/index.html

    This is form 13:
    http://www.webdesigntouch.com/test/webdesigntouch/contact/index.html

    I only got form 13 to work, but I would love to get form 12's button to be the same as form 13's.

    Here's my codes:

    if ($_GET['id'] == 12) or ($_GET['id'] == 13)) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="images/submitBtnForm12.png" name="submit" value="'.$button_text.'" />';
    }
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }
    
    		//markup for submit button
    		$button_markup =<<<EOT
    		<li id="li_buttons" class="buttons">
    			    <input type="hidden" name="form_id" value="{$form->id}" />
    			    {$edit_markup}
    			    <input type="hidden" name="submit" value="1" />
    				{$button_code}
    		</li>

    Thanks in advance again!

    Posted 13 years ago #
  9. yuniar

    I think you missed one opening bracket there.

    Instead of this code:

    if ($_GET['id'] == 12) or ($_GET['id'] == 13)) {

    it should be like this:

    if (($_GET['id'] == 12) or ($_GET['id'] == 13)) {

    MachForm Founder

    Posted 13 years ago #
  10. georgechoi
    Member

    yuniar, I made this change also, but nothing happened. Thanks for the quick reply.

    Posted 13 years ago #
  11. yuniar

    That's weird.
    Can you send me your file please? I'll check it.

    You can mail to: customer.service [at] appnitro.com


    MachForm Founder

    Posted 13 years ago #
  12. georgechoi
    Member

    Hi yuniar, I sent over my view-function.php file through an email from george [at] webdesigntouch.com. Thanks!

    Posted 13 years ago #
  13. webbo
    Member

    Hi, I can change the submit button into a different image for different forms. However, as soon as I add the "else" code my form 1 image changes to a standard submit button but my form 2 still uses my custom image.

    If I remove the "else" code then both forms use custom images. I would like some forms to use standard submit buttons so I don't have to add a line of code for a custom buttom image for every form.

    Any advice?

    if ($_GET['id'] == 1) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="http://www.propertydox.co.uk/graphics/send.jpg" name="submit" value="'.$button_text.'" />';
    }
    
            if ($_GET['id'] == 2) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="http://www.propertydox.co.uk/graphics/pat-pir.jpg" name="submit" value="'.$button_text.'" />';
    }
    
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }
    Posted 13 years ago #
  14. yuniar

    Yes, try to change the code like this:

    if ($_GET['id'] == 1) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="http://www.propertydox.co.uk/graphics/send.jpg" name="submit" value="'.$button_text.'" />';
    }
    
    else if ($_GET['id'] == 2) {
    	$button_code = '<input id="saveForm" class="button_text" type="image"
    src="http://www.propertydox.co.uk/graphics/pat-pir.jpg" name="submit" value="'.$button_text.'" />';
    }
    
    else {
    	$button_code = '<input id="saveForm" class="button_text" type="submit" name="submit" value="'.$button_text.'" />';
    }

    MachForm Founder

    Posted 13 years ago #
  15. webbo
    Member

    That works great, thanks for the help.

    Posted 13 years ago #

RSS feed for this topic

Reply