function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tomstertomster 

Javascript remoting and <apex:form>

Hello,

I've read that in Salesforce1, we should avoid using the <apex:form>. In the same documents, they write that we should try using <apex:input> rather than <apex:inputField>. However, both <apex:input> and <apex:inputField> need <apex:form> to be used. (apex:inputField must occur between <apex:form></apex:form> tags)

When I use <apex:form> with javascript remoting, they seem to come into conflict with each other. The event from the function(result, event)  simply never runs and so any logic beyond that point is impossible. I would normally use sforce.one.navigateToSObject('{!Lead.Id}','detail') to redirect at this point.

If I remove the <apex:form> tags, then the code works fine every time.

My dilema: How to reuse Visualforce components like picklists (would be more scalable if adding choices in a picklist would automatically be added in the Salesforce1 picklist too) and also be able to use javascript remoting to be able to redirect pages.

Have anyone had this problem? Would anyone know what the best practices here would be? Thanks!

References
http://www.slideshare.net/developerforce/visualforce-in-salesforce1-1-1
Andy BoettcherAndy Boettcher
You can use methods in your controller to do getDescribes on fields to populate select lists and other controls through jQuery and the like.  Less clean than the VF form/inputfield, but it works!