I have a part page component. The main form has a button to 'add new address'.
On click I hide the table of addresses and show the panel containing the 'add address' part page component.
This works well. On conclusion on the component I hide the component panel and show the table (complete with new address).
The problem comes when I want to add multiple addresses. Next time I press the 'add new address' button the component shows the final stage of the previously added address.
How do I get the component to refresh / restart? Is is possible?
Thanks
'refresh' a component
Moderators: Jon, Steve, Ian, Dave
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
It sounds like you need to clear the fields in the component when the add new address button is clicked. For example, if I have a component installed with prefix A_COMP1 which contains fields ADDR1 and ADDR2 , the Javascript code will be:
The code assist should give you a list of available component prefixes and then show the fields available within each component.
Code: Select all
components.A_COMP1.fields.ADDR1 = null;
components.A_COMP1.fields.ADDR2 = null;
0 x
-
- Ebase User
- Posts: 331
- Joined: Mon Mar 10, 2014 8:34 am
Thanks Jon, The component is quite old and full of panels which show/hide, tables, fields etc.
I was hoping for something more like
Intellisense suggested it may be possible, ho hum.
I'll rework it.
Thanks
I was hoping for something more like
Code: Select all
components.A_COMP1.refresh()
I'll rework it.
Thanks
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Afraid not, control.refresh() does something a bit different. But you might find that control modifiers is an acceptable way of clearing a whole load of fields. You flag all the Field Controls on a page that you want to refresh with a modifier (General section of all controls) - say "refreshable". Then you can clear them all with code like this:
This way you don't end up with lots of messy code.
Code: Select all
for each (var ctrl in pages.MYPAGE.getControlsByModifier("refreshable"))
{
var f = ctrl.field;
if (f)
{
field.value = null;
}
}
0 x
Who is online
Users browsing this forum: No registered users and 21 guests