+ Start a Discussion
fgwarb_1fgwarb_1 

apex:commandButton rendering type="button" instead of type="submit" while button is in a component

I have the same VF (API 28) page & component (API 28) in two instances of SFDC; full sandbox (API 29) and Production (API 28).

 

In the sandbox the <apex: commandbutton> renders as <input type="submit" ...> and everything works fine.

In production the <apex: commandButton> renders as <input type="button" ...> and it DOESN"T work fine; when pressing the button the form submits properly (because the action is tied to the button), but when pressing the enter key the parameters of the button aren't passed into the controller.

 

I've tried catching the enter key and clicking the button in javascript, but for some reason the form still submits and doesn't work.

 

Has anyone run into this before?

Does anyone know how to force the commandButton to be type=submit?

The commandButton documentation doesn't state the commandButton can even be type="button" so I'm wondering if this is a known issue in v28 that is fixed in v29.

I've created a "dummy" component / page setup in v28 on production and the buttons render as submits!

 

I'm sure someone's going to ask me to post my code, but I'm not in a place to do that (quite yet).

Best Answer chosen by Admin (Salesforce Developers) 
fgwarb_1fgwarb_1

If anyone stumbles across this issue I "solved" it by doing the following:

 

1 - Changing the button to a link

2 - Catching the enter key via jquery / js

3 - Clicking the link in that jquery / js

4 - Returning false from the jquery / js