You need to sign in to do that
Don't have an account?
Pushkar
MVC pattern with custom HTML elements
Hi,
How does the MVC pattern work for visualforce?
If I have a custom HTML element on a visual force page, can I still leverage the power to have the value reflected in the corresponding objet field in the controller.
for. e.g.
<apex: Page customController="MyController">
<apex: form>
<apex: PageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
</apex: PageBlockButtons>
<apex: outputLabel value="custom label"/>
<input id="myInputId" type="text" value="{account.Name}"/>
</apex: form>
</apex: Page>
public class MyController{
Account account;
public MyController(){
account = [Select Id, Name from Account where ...[some condition]][0];
}
public Account getAccount(){
return account;
}
public PageReference Save(){
/***************************************************************
If I enter any value in the <input id="myInputId" ... />
of the page will it be reflected in the account object ?
**************************************************************/
return null;
}
}
Message Edited by Pushkar on 08-08-2008 08:13 AM
How does the MVC pattern work for visualforce?
If I have a custom HTML element on a visual force page, can I still leverage the power to have the value reflected in the corresponding objet field in the controller.
for. e.g.
<apex: Page customController="MyController">
<apex: form>
<apex: PageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
</apex: PageBlockButtons>
<apex: outputLabel value="custom label"/>
<input id="myInputId" type="text" value="{account.Name}"/>
</apex: form>
</apex: Page>
public class MyController{
Account account;
public MyController(){
account = [Select Id, Name from Account where ...[some condition]][0];
}
public Account getAccount(){
return account;
}
public PageReference Save(){
/***************************************************************
If I enter any value in the <input id="myInputId" ... />
of the page will it be reflected in the account object ?
**************************************************************/
return null;
}
}
Message Edited by Pushkar on 08-08-2008 08:13 AM
Well, adding such features could also be done by using certain other library which may just take the Id of the field. But the question is, what if it is required the other way? Can we build certain apex tags of our own, which would enable us to enhance the available tags or even create some new custom apex tags.. Just a thought!
Pushkar