LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 March 4 2010

Joe
Member

Forms in xHTML. Need help!!

Ok I am working as a website developer right now, and I am in desperate need of help right now. I have a small bug I should fix, but first some background infos:

I am working on the forum of the website, in particular the 'mark as favorite' button. For safety reasons, it cannot be done with simple Javascript, and I have to do it by a somewhat complex mechanism.

Instead of a button, we are using a form (POST) that will post data to a PHP controller that will then do the job. Here's the structure of the code:

I cannot really post the actual source (PHP Templates), but you get the idea from the following

<form method="post" action="controler.php">
               <div>
                        <input type="hidden" name="info_we_need" />
                        <input type="image" src="{url_image}" alt="{alt}" title="{title}" />
                        <label for="image">Mark as Favorite</label>
                </div>
</form>

The input of the form is an image in shape of a star (Favorites... duh) and the text is in form of a <label> tag.

My problem is that the label isn't clickable in IE or Opera. It works like a charm with Firefox and Chrome.

Any suggestions?

PS I don't know if I'm being clear enough, don't hesitate to ask for clarifications.

Thanks for the help

Last edited by Joe (March 4 2010)

Offline

#2 March 4 2010

geek
Member

Re: Forms in xHTML. Need help!!

<button ...><label ...></label></button>

perhaps

Offline

#3 March 4 2010

Ayman
Member

Re: Forms in xHTML. Need help!!

Instead of a label why don't you just use a hyperlink and you can change it's style in CSS to have the same appearance of a label and be able to submit the form using java script.

Anyways how about adding a submit button that looks like a label?

<input type="submit" name="submit" value="submit" style="background:none;border:0;color:#ff0000">

Hope this helps, good luck :)

Offline

#4 March 5 2010

Joe
Member

Re: Forms in xHTML. Need help!!

I finally used a <button type="submit" .. >tag, but I was just curious about <labels>?

Are they supposed to be clickable or not?

Offline

#5 March 5 2010

Ayman
Member

Re: Forms in xHTML. Need help!!

I finally used a <button type="submit" .. >tag, but I was just curious about <labels>?

Are they supposed to be clickable or not?

Actually they are supposed to but IE always sucks.

Offline

#6 March 5 2010

rolf
Member

Re: Forms in xHTML. Need help!!

Just replace type=image with type=button then add class=button or just replace "<input" by "<button" (you'll get a button) then, use CSS to skin the button with a background image, like that:

button, input.button {
	background-image: url(images/btn.png);
}

You'll get the same result, clickable everywhere.
i did that for http://www.dergham.com/sarl
the buttons you see are actual submit or button type inputs, but thanks to CSS they are skinned with an image.

Offline

#7 March 11 2010

Joe
Member

Re: Forms in xHTML. Need help!!

Thank you, guys. I ended up using a button. IE is driving me crazy. And since we're all using Ubuntu at the office, it's getting really hard to debug javascript/css issues.

Offline

Board footer