adding JS to template controls (ie <sf:ChoiceField>)?

Posted by Community Admin on 04-Aug-2018 16:26

adding JS to template controls (ie )?

All Replies

Posted by Community Admin on 08-Dec-2012 00:00

Hi, I have altered my registration page to use a drop down of countries, and if it's not the US i'm hiding the States dropdown and showing a Region Textbox.

To do this I'm using Javascript to manage the .style.display property.  Cool, it works.
Uncool... it only works in IE, because IE forgives me for putting the Javascript on the LI tag and not on the INPUT tag.

This is an issue...

I accessed it by simply adding onChange= to the <sf:ChoiceField> tag... is there no way to access the control without having to write and compile a custom class (which is what I'm anticipating your first reaction will be) to access aspects of a control which for all intents and purposes should be pretty accessible by default?

Posted by Community Admin on 26-Jan-2013 00:00

Hello,

In the template you could use for instance:

<script type="text/javascript">
     //your code here
</script>

You could take the Choice field by ID and place your login inside the script section.

If this is not useful I would suggest you to send us your source code and tell us what is the exact problem. If you do not want to share the code with the community, I would suggest you to one a support ticket.

Greetings,
Stefani Tacheva
the Telerik team

Posted by Community Admin on 26-Jan-2013 00:00

actually, i ended up scrapping that all together, because i also needed that address to tie to the billing address of the e-commerce module.  so i used reflector to see how THAT address control was doing what it did and ended up creating my own registration control that creates a billing address entry for the user when they register and a profile control that lets them update it...

considering how many e-commerce oriented sites gather this information at registration and then use it for the commerce segment of the site, i'm somewhat surprised i had to jump through so many hoops to make that work.  one would think that when marketing an e-commerce solution there would also be controls in place to allow the customer user to manage their on file addresses.

This thread is closed