[TYPO3-english] Custom Javascript in View->List forms

Richard Davies richard at ocular.co.nz
Mon Oct 29 21:42:59 CET 2012


Hi again,

I'm unaware of any hooks to do that specifically. I know there are hooks
for before and after saving a record, but IIRC you cannot access the TCA.
There are two files you may find useful hooks in:
1. t3lib_tcemain -> does the saving/loading of TCA form records
2. t3lib_tceforms -> seems to render the TCA forms

Richard

On 30 October 2012 05:04, Guillermo R. Oramas J. <oramas.g at gmail.com> wrote:

> Hi Richard.
>
> I've been considering your suggestions and I really appreciate your help.
>
> Finally I did in the way you explained using ###REC_FIELD_xxxx### and
> requestUpdate and it works well except for the need of reload the form that
> is a bit annoying, but acceptable.
>
> Do you know if there is some hook to use when the requestUpdate is called,
> because I think that is a good moment to include custom javascript and do
> the update using Ajax.
>
>
> 2012/10/25 Richard Davies <richard at ocular.co.nz>
>
> > Hi again,
> >
> > There are two things that I know of for conditional display in TCA, but
> > neither of them involve you adding javascript. If you need the javascript
> > for alerts etc, you can add a phantom field (e.g. a field called "js"
> thats
> > just an int 1 in the database) so you can add a userfunc to the page.
> >
> > 1. If you want to hide a certain field (e.g. if a user chooses 'hide' in
> > one select box the next select box hides), you can use displayCond[1]
> > (which isn't what you want)
> >
> > 2. From what I understand you want to hide certain values within a select
> > box. If the values in select box B (that have some values you want to
> hide)
> > are from a foreign table, might be able to use  foreign_table_where mixed
> > with ###REC_FIELD_[field name]###[1].
> > For example, set requestUpdate for field A (country), then add a
> > foreign_table_where clause for field B (state) stating something like
> > 'foreign_table_where' => ' and parentcountry = ###REC_FIELD_country### '
> > and set
> > $*TCA*['tablename']['ctrl']['requestUpdate'] = "country"
> >
> >
> > Reference: [1]
> >
> >
> http://typo3.org/documentation/document-library/core-documentation/doc_core_tca/4.7.1/view/1/3/
> > The above may not be able to do what you want it to do, depending on the
> > specifics.
> >
> > Richard
> >
> > On 26 October 2012 11:43, Guillermo R. Oramas J. <oramas.g at gmail.com>
> > wrote:
> >
> > > I still have a doubt. It is necessary to use "user" field type to load
> > > Javascript code?
> > >
> > > Because in the Xavier's example he is really using a new custom field.
> > > Maybe this works to display an alert, but in the case of changing a
> > > selector depending on the choise in other selector is a nonsense to
> write
> > > all the code for a custom selector when I already have it in the TCA.
> > >
> > > How can I load Javascript code to a "normal" field?
> > >
> > > 2012/10/25 Guillermo R. Oramas J. <oramas.g at gmail.com>
> > >
> > > > Thanks!
> > > >
> > > > What a awesome example!:
> > > >
> > >
> >
> http://xavier.perseguers.ch/tutoriels/typo3/articles/google-map-in-tca.html
> > > >
> > > > 2012/10/25 Richard Davies <richard at ocular.co.nz>
> > > >
> > > > > Hi Guillermo,
> > > > >
> > > > > Check out this previous question about it, and specifically
> > Perseguers
> > > > > answer.
> > > > >
> > > > > http://lists.typo3.org/pipermail/typo3-dev/2011-August/044024.html
> > > > >
> > > > > Richard
> > > > >
> > > > > On 26 October 2012 05:51, Guillermo R. Oramas J. <
> oramas.g at gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Sorry if this is a repetitive question, but I couldn't find any
> > > > concrete
> > > > > > information about this.
> > > > > >
> > > > > > I have a table, I configured the TCA, and now I need to display
> > some
> > > > > alerts
> > > > > > when the users select some options in one of the fields. Also I
> > need
> > > to
> > > > > > change a conditional selector (state) depending on the option of
> > > other
> > > > > > selector (country), so the question is How can I add Javascript
> > code
> > > to
> > > > > do
> > > > > > this, without breaking the code or my brain?
> > > > > >
> > > > > > Thank you for any clear piece of advice.
> > > > > >
> > > > > > Guillermo O.
> > > > > > _______________________________________________
> > > > > > TYPO3-english mailing list
> > > > > > TYPO3-english at lists.typo3.org
> > > > > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> > > > > >
> > > > > _______________________________________________
> > > > > TYPO3-english mailing list
> > > > > TYPO3-english at lists.typo3.org
> > > > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> > > > >
> > > > _______________________________________________
> > > > TYPO3-english mailing list
> > > > TYPO3-english at lists.typo3.org
> > > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> > > >
> > > _______________________________________________
> > > TYPO3-english mailing list
> > > TYPO3-english at lists.typo3.org
> > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> > >
> > _______________________________________________
> > TYPO3-english mailing list
> > TYPO3-english at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
> >
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>


More information about the TYPO3-english mailing list