In the last week I couldn’t’ fix a problem with my app. The problem is I can’t figure out how to use pageview pages separately. Basically i want to add/subtract numbers in one page but don't want to change the numbers on the other ones.
This is my code:
https://gist.github.com/Matelevi12/1d847efe5ace8a25d4676a32332ebd85
Please help me it’s really annoying. I read every article online, but nothing.
You will need an array of numbers then for each page.
if you have 3 pages then store the numbers in an array like this
var arrayOfNumbers = [5,5,5];
Then access them using the page index. Use the PageController to access the currently selected page and call that index from the array to retrieve the value saved in the array for that page. If current page is 1 then use arrayOfNumbers[1] to get the specific value for that page.
Related
Currently, we are working on Kentico CMS 9.0 version.
We are facing some development issue on below scenario:
There is a static message getting displayed on a Success page after
Registration. This Text is written in WebPart -- > HTML Envelop
section - Content after But we want to change this text dynamically
as per User selects the Band category.
Example If User registers for 1-10 Band category, then text message should be displayed as “ Fees $1, 500 / two years”, or if the range of 2-20, then “Fees: $2,500 / two years” etc.
We tried with Macros on this, but not getting the exact solution. Also tried with relating the pages to get value from this Category pages. But no luck.
If anyone has any pointers on this. Or whether it could be possible to do this in Kentico CMS, please let us know ASAP.
If the data the user is submitting is part of the user's record or attached to a user's ID you could do a lookup using a macro or create your own custom macro to do the work for you.
For instance, if the value the user selected is attached to the user's record and they are logged in after they register, you can use something like:
CurrentUser.GetValue("CustomFieldName")
This all depends on what the value is that you're storing. If you're storing an integer or key of some sort to another table, you'll need to get that key and do another lookup to that other table to get the actual display value. Something like this:
var userRegisteredValue = CurrentUser.GetValue("CustomFieldName");
GlobalObjects.CustomTables["CustomTableNamespace.CustomTableName"].Items.Where("ItemID = " + userRegisteredValue);
I looked around but can't get my goal result. All my Stripe Payment money values are stored as default integers and saved in the db this way. When I pull the values from the db and load them into a variable to pass to a handlebars rendered page, I can see the value without a decimal point as expected, when I keep that same form value and pass it to my pay button from Stripe, passing the integer amount to this button gets the value as expected in payment, but what can I do to format that integer on the front end to give it a pretty $USD.XX value, yet keeping the db working with integers? When I divide the amount by 100 in the route that returns these values, this converted value finds its way back into the Pay Button, and sends a lower amount when payment dialog pops up. I want to avoid this problem by intercepting the integer amount, performing format translation only for the front end to displaying the prettys. I also got a form that edits this, but I don't want my users to have to worry about needing to enter only an integer value, so hopefully a filter that responds like an atm, when you start to enter values in there, pennies first... I just can't find the easy button to this problem.
I got to my desired effect,
The work around I did was to create the 'placeholder' variables that will hold as a string the values of the formatted amounts ie. bal for Model.balance, quo for Model.quote, cre for Model.credit.
In the route will do the conversion: setting the temporary placeholder variable with the formatting code and passing it out to render...
job.bal = parseFloat(Math.round(job.balance / 100)).toFixed(2).toString();
job.cre = parseFloat(Math.round(job.credit / 100)).toFixed(2).toString();
job.quo = parseFloat(Math.round(job.quote / 100)).toFixed(2).toString();
The returned values have these temp placeholder values with the format I'm looking for.
Note: I had to add the placeholder variables into the Model.Schema, and also into the instance that creates this schema before I was able to even populate it with the parseFloat(...)
After that I was able to view in the .hbs render the decimal'd amount values as a string, out to the view displaying these values.
When I click the Pay Now button, it its passed the original {{balance}} into the
data-amount: {{balance}}
I use {{balance}} etc. for the backend integer amount format that Stripe likes, then use {{bal}} etc. for the front end view for the users to see their monetary values in a toFixed(2) decimal'd view.
Whether of not this is best practice, probably not, but it's a solution I found, implemented and wanted to share.
I have a document in Google Docs which has a lot of images numbered sequentially. Every time I add a new image in the middle of the document I have to renumber all the image numbers along the document along with its references. How could I renumber the following images automatically, like we can do in LibreOffice using variables?
so far it is not possible. You could take a look at Google Apps Scripts to create a macro that does that: https://developers.google.com/apps-script/
I've just finished creating a Google Docs Add-on (https://support.google.com/docs/answer/3641454?hl=en) that can number images and tables. It is going through the process of certification by Google and I hope to publish it soon :)
Regards
You can use Crossref. The way it works is that you higlight the text referring to a figure, which can be anything e.g. "Figure n" as the add on will replace it.
You then use Ctrl + K to make this into a link to a non existent bookmark such as "#figur_heights" where you can put any text you like after the "#figur_..." Do that for all the figures in the document and when you refer to a figure use an identical non existent bookmark, except it starts as "#fig_..." e.g. "#fig_heights". In this way it can number the figures consecutively and use matching numbers for the in text references.
Finally you then need to go to Add ons > Crossref > Update and it will go through and update all the text for those bookmarks to the sequentially numbered Figure 1, Figure 2 etc. You need to do that whenever you change the order of the figures in your document, add a new reference etc, anything that will change the way the figures are numbered.
I am not a programmer but I have to create an expense form for traveling. It has to be in PDF format (preferably Adobe Acrobat editable). I created the form with Excel and exported it to Adobe but, of course, the formulas do not transfer.
I have 3 pages that are identical for calculating travel expenses with the only difference being there is one extra cell on the first page that calculates totals from each page to a grand total. Sounds easy. All the pages calculate individually with no problem but I cannot reference the totals from the individual pages to the first page where the grand total is.
I am using Adobe LiveCycle because it "simplifies" the programming process for people like me. It has worked great so far but this is the only thing problem I am having and the only thing holding me from using the form.
All three pages are in the same document. When I use FormCalc for the totals within each page, it works great:
topmostSubform.Page1.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
If I go to the next page, it looks like this:
topmostSubform.Page2.P1TotalGrand::calculate - (FormCalc, client)
$=P1MileageTotal+P1TransAirTotal+P1CarRenTotal+P1HotelTotal+P1AllowTotal+P1PhoneTotal+P1MIETotal+P1BusMealTotal+P1OtherTotal
I just want to be able to add them together. When I try, it doesn't recognize the 2nd page and I don't know why. The form is pretty basic and I would really appreciate any help. If you need any additional information, I'll be glad to oblige.
I believe you can do it. There should be many ways and I am a newbie too so here are two ways...
If you want grand total of 2 pages - does not matter on which page you want it, the formula should be like
topmostSubform.Page1.P1GREATTotalGrand::calculate - (FormCalc, client)
$=P1TotalGrand+P2TotalGrand
The trick is to select both by press and hold Ctrl Key, then select the field you want to select rather then type in. this should solve the problem.
If you want the total to be at page one.
Make the P2GreatTotalGrand to be a global data and create the same data field on page one and add this new one and one already on page one to get the grand total on page one.
I have a calculated column in a custom SharePoint 2007 list, with the following formula:
=CONCATENATE("IR-",[ID],"-",LEFT(UPPER([Title]),25))
If an item is created in the list, everything is fine, however, when an item is updated the [ID] column is no longer in the calculated column for that item.
So, on creation: "IR-40-TheTitleIsHere", but after edit, it is, "IR--TheTitleIsHere".
Anyone have some insight on why this would be happening?
I confirm the behavior mentioned above. Any Add/Edit will wipe out the [ID] portion. If you edit the column in the list and update the formula, it will update ALL list items to be correct (until you do an edit on the item).
I found this post that mentions the same problem.
Sounds like the only solution would be to make a simple workflow using SharePoint Designer that would update a text field in your list.
I had an issue similar a while back. Through other blogs and experts, I discovered that the [ID] column should not be used in a calculated column because it wreaks havoc and causes many errors. Sorry - remove the ID column and you should be fine.
This question is a little old, but I had the same issue and found a solution for it. It is a pretty specific fix and won't help everyone -- it involves using javascript in a content editor web part to update the calculated field.
This site -- http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/ -- gives an example of how to use javascript in the same manner that I used it.. the important block of code is the first while loop. The point is to grab the out of box ID column from the list and update whatever calculated field needs the ID.
In my case I had a URL in a calculated field that required the ID as a parameter.. of course that wouldn't work normally because you can't put the ID in a calculated field. What I did was I put "?ID=null" in the ID parameter of my calculated field's url, I then replaced that with the ID that was retrieved using javascript.. so whenever the page is loaded, the js kicks off and updates all of the URLs to have the correct ID.
I know this is very old but I couldn't find a newer version of the question anywhere else and the answer above from ferr solved the problem for me but isn't very clear so I thought I'd update it.
This assumes that you want to use the ID in the output HTML (for example within a link), I think this is fairly common.
Using the javascript from the pathtosharepoint link I added in the following to get the id with an if statement for safety:
if (HTMLregexp.test(CellContent)) { //original pathtosharepoint line
if (NodeSet[i].parentNode.getAttribute("iid")){
var SPID = NodeSet[i].parentNode.getAttribute("iid").split(",")[1];
CellContent = CellContent.replace("SPIDReplace", SPID)
}
NodeSet[i].innerHTML = CellContent; //original pathtosharepoint line
This is put in the while loop of the latest pathtosharepoint fix at time of writing. This works for me on SharePoint 2010.
Note: Include the string "SPIDReplace" in your calculated column to get it replaced by the item ID.
pathtosharepoint page: http://blog.pathtosharepoint.com/category/calculated-columns/
pathtosharepoint code: http://pathtosharepoint.com/Downloads