Custom field control and module builder

Posted by Community Admin on 04-Aug-2018 09:42

Custom field control and module builder

All Replies

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

Hi,

I have two custom field controls, one is for date Calender control and second is for week number. Date field is working fine and I have implemented the logic/handler to calculating week number which return week number on the selection on calendar date. Now I want to fill this value to another field(Week Number). Please suggest me some solution. I have been trying some value override but couldn't find the field value on View page source as well. I couldn't find how value is being rendered on page.

Thanks for your help!

Regards,

Tarun


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

Hello Tarun,

 Thanks for using Sitefinity.

I'm not entirely sure what you are trying to accomplish so could you send a video demonstration or screen shots of your layout? Are you trying to add a custom field selector to a module builder field to allow someone to select a week?

Thanks in advance for the additional info.

All the best,
Patrick Dunn
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

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

Hi Patrick,

Thanks for the reply!

Please see attachment I have comments on image. I hope this will help you.

Kind regards,
Tarun

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

Hi Tarun,

 So on your back end you want it so when a date is selected the "testnumber" field is populated with the week number for that year, correct? Can you send me the code you are trying to use for this?

Keep in mind you can also do this client side and populate the field as such which would allow the submission of the form to act accordingly without any overrides.

For example, getting the ISO week number:

Date.prototype.getWeek = function()
    var determinedate = new Date();
    determinedate.setFullYear(this.getFullYear(), this.getMonth(), this.getDate());
    var D = determinedate.getDay();
    if(D == 0) D = 7;
    determinedate.setDate(determinedate.getDate() + (4 - D));
    var YN = determinedate.getFullYear();
    var ZBDoCY = Math.floor((determinedate.getTime() - new Date(YN, 0, 1, -6)) / 86400000);
    var WN = 1 + Math.floor(ZBDoCY / 7);
    return WN;

you could call it like this:
var mydate = new Date();
var weeknumber = mydate.getWeek();
                

Then just set the value of weeknumber in the textbox. Kind regards,
Patrick Dunn
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

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

Thank you Petrick for replying!

I am able to calculate Week number. What I am trying i want populate that number in That sitefinity custom field. Lets take it simple, forget week number. When I select Week in first field then the same date should be populate in Testnumber second field. Just give me some idea or sample...if I enter a value in first field then same value should be populate in second field too.

Kinds regards,

Tarun

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

Hello,

I hope the email finds you well.

We are aware of that. The script I provided was to do it all client-side which you could append to your backend designer. If you are not aware of how to modify the designer please take a look at this blog post. With the script provided you could attach a js function to the DateTime textbox that, when changed, calculates the week and then puts it in the other textbox.

I hope it will help you. 

Greetings,
Patrick Dunn
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

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

Hi Patrick,

You mean, to achieve this small function I have to create a CUSTOM MODULE without module builder.

I have to go through following 5 steps.

Part 1: Project Setup and Hello World

Part 2: Data Layer

Part 3: Backend Administration

Part 4: Frontend Controls

Part 5: Module Installation

This involves a lot work. As in Forum thread I have mentioned that I am creating module through Module Builder.


I just want to fill a value from one Custom field to another custom field. Please show me this feature in your custom field sample "Telerik.Sitefinity.Samples" if possible.

Please let me know if this is not possible without Custom Module which you suggested.


I look forward to your reply ASAP.


Thanks,

Tarun

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

Hi Tarun,

No, you don't have to use a custom module. It was an example on modifying the designer for a module. I have given you examples on how to implement this via the custom client side code and overriding the designers which you can do for a module built in the module builder. 

If you require custom functionality I will have to refer you to our professional services division or one of our partners.

Greetings,
Patrick Dunn
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed