Adding javascript onclick event to field
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 97
- Joined: Thu Sep 13, 2007 6:07 am
- Location: The Netherlands
Adding javascript onclick event to field
Is it possible to add an javascript onclick event to a field?
0 x
What's the meaning of Justice...
-
- Ebase User
- Posts: 94
- Joined: Fri Sep 14, 2007 12:18 pm
- Location: The Netherlands
- Contact:
-
- Ebase User
- Posts: 97
- Joined: Thu Sep 13, 2007 6:07 am
- Location: The Netherlands
Re: Adding javascript onclick event to field
Mmm, you people of Rotterdam are very short with answers . I also should have asked how hahahaAJDulk wrote:Sure.
So, how am I able to do that?
0 x
What's the meaning of Justice...
-
- Ebase User
- Posts: 94
- Joined: Fri Sep 14, 2007 12:18 pm
- Location: The Netherlands
- Contact:
Re: Adding javascript onclick event to field
Sorry for not getting back to you earlier. The easiest way is to use an Event Listener. In the HTML++ you place a reference to your JavaScript that includes the code that parses the code looking for the field and adds the watch on the onClick event.
Depending on what browsers you are looking to support you may have bubbling issues - that is where the order in which things are processed and whether or not the processing stops may be an issue.
For an Ebase centric solution I would need to dive into the Ebase documentation and see what they have (sometimes it surprises me what has been added since I first started using Ebase).
Depending on what browsers you are looking to support you may have bubbling issues - that is where the order in which things are processed and whether or not the processing stops may be an issue.
For an Ebase centric solution I would need to dive into the Ebase documentation and see what they have (sometimes it surprises me what has been added since I first started using Ebase).
0 x
-
- Ebase User
- Posts: 97
- Joined: Thu Sep 13, 2007 6:07 am
- Location: The Netherlands
Re: Adding javascript onclick event to field
I have done that already.AJDulk wrote:Sorry for not getting back to you earlier. The easiest way is to use an Event Listener. In the HTML++ you place a reference to your JavaScript that includes the code that parses the code looking for the field and adds the watch on the onClick event.
And that's the problem which I ran into.AJDulk wrote: Depending on what browsers you are looking to support you may have bubbling issues - that is where the order in which things are processed and whether or not the processing stops may be an issue.
I agree with you. However I did not find anything useable in the documentation this time.AJDulk wrote: For an Ebase centric solution I would need to dive into the Ebase documentation and see what they have (sometimes it surprises me what has been added since I first started using Ebase).
0 x
What's the meaning of Justice...
-
- Ebase User
- Posts: 25
- Joined: Thu Aug 27, 2009 9:43 am
- Location: Hampshire County Council
- Contact:
Hi Vircos
We use the buildFieldArray() function that is supplied by Ebase to retrieve an array of all Ebase fields. You can then assign a function to the onclick event of each field:
The above assigns the same function to all fields, but you could add some conditions in there to check for a specific field or field type, eg:
Hope this helps
Simon
We use the buildFieldArray() function that is supplied by Ebase to retrieve an array of all Ebase fields. You can then assign a function to the onclick event of each field:
Code: Select all
function assignOnClick()
{
var countFieldArray = buildFieldArray();
for(var i = 0; i < countFieldArray.length; i++)
{
var thisName = countFieldArray[i].fieldName.replace('F:','LF');
var thisField = document.getElementById(thisName);
thisField.onclick = onclickfuntion;
}
}
Code: Select all
if (thisField && (thisField.tagName == "TEXTAREA"))
Simon
0 x
Who is online
Users browsing this forum: No registered users and 28 guests