My code works in Mozilla but not in IE - what's the problem |
[eluser]cinewbie81[/eluser]
Hi all, I have a 'Customer' Controller class as following: Code: <?php and the customer view form as following: Code: <?php When i click at the button 'Add' from cutomer_view, it will go to 'action' function, then will echo the message 'Add'. It is working in mozilla firefox, but in IE6 and IE7 it doesnt echo me anything. What is the problem anyone ? I've been finding the solution for quite a while but still no avail
[eluser]cinewbie81[/eluser]
In case anyone want to know what's inside view_header and view_footer, here it is: view_header Code: <?php if (!isset($ajax)){ $ajax = 0;} Code: <?php if (!isset($ajax)){ $ajax = 0;} if ($ajax) { return; } ?>
[eluser]Alex007[/eluser]
I ran into the exact same problem. The thing is, IE does NOT pass the "value" when input type=image. Mozilla does. To test, change it to a button, everything will work. I haven't looked into a solution yet, but I guess I'll have to use javascript with a normal image. Clicking on the image will set a value for a hidden field, then submit the form. It sucks, but I'm still trying to find better ways. That, or use normal buttons, and style them with CSS, which I haven't tried.
[eluser]cinewbie81[/eluser]
so is that mean i have to change all my image to button ? ARGHHH that's gonna cause me quite some times to change my WHOLE module .. Anyway, cheers alex.. You have just save my time for figuring out the problem .. thanks alot.. and if anyone here have any idea how to solve it, feels free to post a reply here .. thanks again in advance
[eluser]xwero[/eluser]
you can use name for input type image to pass a value. The only caveat is that the name is prostfixed with _x and/or _y because browsers pass the coordinates of the click that way.
[eluser]Alex007[/eluser]
You can style submit buttons with CSS: http://www.ampsoft.net/webdesign-l/image-button.html
[eluser]cinewbie81[/eluser]
[quote author="xwero" date="1195861180"]you can use name for input type image to pass a value. The only caveat is that the name is prostfixed with _x and/or _y because browsers pass the coordinates of the click that way.[/quote] Hi, can you please elaborate with code ? I dont quite understand what do you mean .. thanks
[eluser]xwero[/eluser]
I didn't take a good look at your code but i saw now you have a name for you button so you could get your post as follows Code: if ($this->input->post('add_y')) {
[eluser]cinewbie81[/eluser]
Now it's works .. Didnt know that you have to put a postfix 'x' or 'y' when u want to pass a value from input image type .. Thanks
[eluser]Seppo[/eluser]
You should check it against false, checking also the type. I believe some times it is submitted with a 0 value (not sure when, may be when pressing enter button or when there are multiple submit images) Code: if ($this->input->post('add_y') !== false) { |
Welcome Guest, Not a member yet? Register Sign In |