WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: Shefra on September 01, 2011, 08:20:20 PM

Title: Pagesettings (overview)
Post by: Shefra on September 01, 2011, 08:20:20 PM
Hello,

I want to change the input type from submit to image:

Quote
<form action="[SHOP_URL]" method="post">
<input type="submit" name="view_cart" class="mod_bakery_bt_cart_ f" value="[VIEW_CART]" />
</form>

to

Quote
<form action="[SHOP_URL]" method="post">
<input type="image" src="http://<websitename>/<image.img> name="view_cart" class="mod_bakery_bt_cart_ f"  />
</form>

When i click on the image the webshop is reloaded instead of showing the cart.

Do i overlook something?

Thanks

Frank

Title: Re: Pagesettings (overview)
Post by: freeSbee on September 01, 2011, 08:48:22 PM
http://www.bakery-shop.ch/#navigation

Regards Christoph
Title: Re: Pagesettings (overview)
Post by: Shefra on September 02, 2011, 09:22:13 AM
Do i missing something? I read this section but i can use the input type="image" as well but is doesn't work.
Title: Re: Pagesettings (overview)
Post by: freeSbee on September 02, 2011, 10:30:30 AM
Please post or pm (https://forum.WebsiteBaker.org/index.php?action=pm;sa=send;u=5997) a link to the site.

Regards Christoph
Title: Re: Pagesettings (overview)
Post by: DarkViper on September 02, 2011, 10:50:17 AM
Hello,

I want to change the input type from submit to image:

Quote
<form action="[SHOP_URL]" method="post">
<input type="submit" name="view_cart" class="mod_bakery_bt_cart_ f" value="[VIEW_CART]" />
</form>

to

Quote
<form action="[SHOP_URL]" method="post">
<input type="image" src="http://<websitename>/<image.img> name="view_cart" class="mod_bakery_bt_cart_ f"  />
</form>

When i click on the image the webshop is reloaded instead of showing the cart.

Do i overlook something?

Thanks

Frank




so it should work.

Code: [Select]
<form action="[SHOP_URL]" method="post">
    <input type="hidden" name="view_cart" value="[VIEW_CART]" />
    <input type="image" src="http://websitename/image.img" name="view_cart_submit" class="mod_bakery_bt_cart_f" alt="[VIEW_CART]" />
</form>

why?
Your Input-Image-Tag does not submit a value ([VIEW_CHART]), that's why the script goes the default direktion (reload).
By the Hidden-Input-Tag now the value for $_POST['view_cart'] is submitted explicitly and all should work well again.
PS: an image needs the Alt-property also.
Title: Re: Pagesettings (overview)
Post by: freeSbee on September 02, 2011, 11:43:18 AM
Bakery just uses the name attribute for controlling. But since the value attribute hast to be set and must not be empty just add it to the <input type="image" ... /> tag:

Code: [Select]
<form action="[SHOP_URL]" method="post">
<input type="image" src="http://www.yourwebsite/your_directory/your_image.img>" name="view_cart" value="[VIEW_CART]" alt="[VIEW_CART]" class="mod_bakery_bt_cart_ f" />
</form>

Regards Christoph
Title: Re: Pagesettings (overview)
Post by: DarkViper on September 02, 2011, 12:03:12 PM
value = "" inside an input tag of type image can be a trap to run in an issuse.

Quote
Note:
For graphical buttons not only of any existing value in the attribute value is transferred, but additionally the coordinates of the click on the image. The (as of PHP from name_x / name_y) states, two additional values ​​sent in the form and Name.x name.y. IE will only send the coordinates.
(translated by google from german website SelfHTML (http://de.selfhtml.org/html/formulare/formularbuttons.htm#grafische)

so the better and more secure solution is to use a input-hidden tag.
Title: Re: Pagesettings (overview)
Post by: freeSbee on September 02, 2011, 01:19:22 PM
value = "" inside an input tag of type image can be a trap to run in an issuse.

Since version 1.5.3 Bakery provides a bugfix for IE, that takes car of that:
http://www.bakery-shop.ch/#version_153

Regards Christoph
Title: Re: Pagesettings (overview)
Post by: jacobi22 on September 02, 2011, 05:55:17 PM
I use CSS with the Original Code (no Image for Submit-Button inside the Code)

my CSS for the submit-Button
....
input[type=submit], input[type=reset] {
        background: #ffffff url(../img/submit_button.png) repeat-x;
        color: #000000;
}
input[type=submit]:hover, input[type=reset]:hover  {
        background: #ffffff url(../img/submit_button_on.png) repeat-x;
        color: #000000;
}
-----
Title: Re: Pagesettings (overview)
Post by: Shefra on September 05, 2011, 09:24:23 AM
Thanks for the answers. DarkViper your solution did it....

Thanks again.....