You need to sign in to do that
Don't have an account?

Create basic form
How can I create a basic form that is not bound to an object. I just want some inputFields with a submit button, that gets processed in the custom controller class, then finally output some text on the page saying if it was successful or not.
Here's what I have
I am getting an error 'value for inputField is not a dynamic binding!'
How can this be done?
Here's what I have
Code:
<apex:form > To <apex:inputField id="to" />
From <apex:inputField id="from" />
Message <apex:inputField id="message" />
<apex:commandButton value="Send" action="{!sendSMS}" />
</apex:form>
I am getting an error 'value for inputField is not a dynamic binding!'
How can this be done?
I think you can at least get some input by simply using
inputText instead. ie. in your form have:
But this isn't typed at all. ie. if myTo is a date field, you don't get a date picker - uh. Perhaps you can create a custom object that extends SObject in some wa and reference its fields instead? (I don't know)
<input type="text" />
The only problem is how do I have the form submit to itself and pickup the values that were submitted?
Thanks for the help
And here's a simple controller:
The method sendSMS has access to the form input (myTo) because it's bound to myTo from the Visualforce page by using the {!myTo}.
Hope that helps
Jon
After I have accessed the inputs, is it possible to write back to the VF page with an output message? For example 'the message has been sent'.
Thanks a lot
Check out the Visualforce documentation, it should guide you on this.
(http://wiki.apexdevnet.com/index.php/Documentation)
Look for the sections on AJAX and "rerender". Look also at the example on around page 58 on Controller Methods/Setter Methods - It has a nice example ("For example, the following markup displays a page that implements basic search functionality for Leads .... ") that updates a block with search results.
Cheers
Chris
Have you checked out the docs yet? They seem to have a selectList and selectOption (around page 182) that looks like it will do the trick for you. You should also be able to find them by hitting the "component reference" link in the inline Visualforce page editor.
LMK if that works.
Regards,
Jon
What I have now is a VF page with the standard controller on my custom object. I also have a custom controller as an extension. All of the fields are displayed fine (with the types e.g datepicker).
The submit button calls {!Save} which is a page ref in my extension class. When I try to output one of the form vars, its just ouputing the var name e.g. 'The value is: To__c'. If i can get access to these then I can keep the field types.
My VF page:
Entension controller:
I suspect (i can't tell, not all the source is here), that your controller extension is not doing the work of grabbing the current object from the controller. ie. it's constructor should have something like "this.mysend = (SentSMS__c) controller.getRecord()"
Then your debug statement can use "mysend.to__c" to grab the variable.
See "Building a Controller Extension" in the Visualforce documentation.
LMK how you get on.
Regards,
Jon
Your suggestion worked and I hae access to the variables.
The one thing that I can't find any information about is how to write messages back to the VF page and cancel the save if needed.
For example:
1. Form is submitted
2. First run my apex code to do some verification checks (user has enough credits)
If checks fail, show message on page 'Insufficient credits'
If checks pass, call Send() and continue to save the record.
I appreciate your help on this!
Cheers
Chris
See my previous post on Ajax and rerender.
In an Apex class how can I get the current Salesforce User ID?
Thanks
Chris
Regards,
Jon