close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

using image as a button

Thread began 4/23/2014 2:25 am by Jamie | Last modified 4/23/2014 2:04 pm by Jamie | 323 views | 2 replies |

Jamie

using image as a button

Hey Jason

In a search if I use the following submit button the search works exactly as expected and in testing returns the correct records:

<input type="submit" name="WADbSearch1" Value="GO" style="cursor:pointer; font-size: 30px; color: #fff; background-color: #4879BE; border: none;">




If I change it to using an image for the button, it returns the same record regardless every time regardless of what has been searched

<input type="image" src="images/misc/go.jpg" name="WADbSearch1" class="searchSubmit" Value="" >



Am I not able to use an image for the submit button in a search?

Cheers

Jamie

Sign in to reply to this post

Jason ByrnesWebAssist

If you change the element type from a submit button to an image, and if the Data Assist Search uses the original submit button as the trigger, then the trigger code will need to be updated.

A submit button has a value attribute, whereas an image element does not support passing a value.

Instead, with an image button, it passes the x and y coordinates of where the mouse clicked the image.

for example, the trigger code for a submit button would look like this:

if (isset($_POST["WADbSearch1"])) {



and in the case of your submit button code:

<input type="submit" name="WADbSearch1" Value="GO" style="cursor:pointer; font-size: 30px; color: #fff; background-color: #4879BE; border: none;">




the value of:

<?php echo $_POST["WADbSearch1"]; ?>



would write to the page:
GO


once you change it to an image, the value attribute is no longer valid, so even if you had:

<input type="image" src="images/misc/go.jpg" name="WADbSearch1" class="searchSubmit" value="GO" >



the above echo would not write anything to the page, because no value is passed, instead, there is an x or y coordinate, so to write a value, use:

<?php echo $_POST["WADbSearch1_x"]; ?>



and that will write the x coordinate for where the image was clicked.

so, for the trigger code, it needs to be edited to:

if (isset($_POST["WADbSearch1_x"]))     {
Sign in to reply to this post

Jamie

Thanks Jason. Will take a look at the above in a few days (having eye operation tomorrow so will not be able to see for a couple of days)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...