Using ASP classic to produce a label template for printing [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a problem that I'm not sure how to approach. Here is some background:
We are using a web application that can be extended with ASP classic and JavaScript
The web app contains details of clients
Users of the web app need to be able to print an address label for a specified client
The user needs to specify which label on the sheet will be used
Now I can get all the information that I need about the client and which label is to be used next but I have no idea how I should go about printing the label. I have an inkling that I should be doing some sort of mail merge and displaying the result to the user for printing but I don't know how I'd go about getting the screen laid out correctly for the labels. Should I be creating some kind of PDF and displaying that? If so how would I go about doing so?
This is all very new to me so any help would be much appreciated, Thanks!

At FVI we have the same issue and solved it as old school as it gets.
First we created a rtf document of the label we wanted. In this template we had key words in the file such as ##CUSTOMER## and ##ADDRESS01##.
Step one was opening the template into memory, text substitute the key words and save to a web link for opening and printing.
By making a new RTF file on the fly we did not have to worry about the software on the other end of the connection. we just presented our factory with a correctly formatted response that fit to the printer definition we had established.
Thus on the web page it has a select option for label type and that loads the correct template into memory for final output.
Not the best way to do it, but it cost us only 1 day of layout and simple html programming and zero issues with our China Factories.

Related

How to create a react website that displays formatted user generated text? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 months ago.
Improve this question
Let's say you want to display writing on your website. Maybe it's a blog or a website like a medium or even Stackoverflow. You want users to be able to submit their writing. Format the text (make certain parts bold or italic), insert pictures between texts, and so on.
How would you go about doing this? I think I could figure out hacky ways to do it, but what is the best practice for making that sort of website?
If you're using a headless CMS, wysiwyg editor, markdown editor, ... you'll most probably get HTML back as a string, which you'll need to output.
As you might have noticed, hence you question, you can't just output <div>{html}</div> in your React component. This is because React escapes certain characters to prevent XSS.
In order to display user submitted HTML, you can use https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml. The reason for the weird name is that you will allow users to output unsafe HTML which might execute JavaScript or network requests on your website. This can have huge security consequences. You'll have to run the HTML through a sanitizer, which will strip any HTML attributes that can be used to execute JavaScript and escape characters like React does. Don't attempt to do this yourself, people constantly find new ways to bypass these sanitizers.
Sanitizers you can use:
https://github.com/cure53/DOMPurify
https://github.com/apostrophecms/sanitize-html
Email applications will sometimes use a sandboxed iframe to display raw HTML from emails but for content that's not really an option (SEO).

Simple local search function. Javascript and JSON? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Building a 'fake' web browser and web pages that are all compiled locally in a windows form application. The whole thing operates offline.
I need to build a search function on one of the web pages I've made. Obviously theirs no server involved, so I have to have the data extracted and displayed from a local source. I've used 'Jput' before in a previous project so i was thinking about having a Json file that can be called. The site is a fake social network, so when a user searches a name or phrase, it displays related results (profiles) either on a separate page or within the current doc. Jput is good, but its pretty limited when it comes to styling.
QUESTION
What would be the best way of doing this? How would I index all these results and how would the search engine work?
Let me know if more detail is needed for this question
Thanks!
You can use a normal Javascript array ( that can be stored as json) :
Example data:
var users=[
{name:"John",age:22}
{name:"Jack",age:23}
]
Now you can search after name:
document.body.innerHTML=users.filter(el=>el.name.split("Ja")[1]).map(el=>el.name).join("<br>");
This will show all users that names contain "Ja"inside of the document ( or any other html elem, can be based on users input).
You can easily show a users profile like this:
user=users.find(el=>el.name=="Jack");
for(key in user){
alert(key+":"+user[key]);
}
This is just the beginning of what you can do with natives js, no need for libs etc.

How to created input data with Drupal? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
So, I've been doing programming and HTML for some time now. A lot of it is front end working with CMSs and stylizing. However there's one thing I've been wanting to learn.
When it comes to drupal, how do I go about creating something where a user can enter in text and it appears above? Honestly, I'm not sure if I'm even asking about it correctly. It's something a lot of websites already have so I'm sure it's not too difficult to answer.
The best example might be Basecamp. Essentially what I'm looking to do is that if a user is on a project they are apart of, I want them to write in a little text box (similar to what i'm doing right now) click submit and it appears in a comment section above. Some sort of simple form that links directly to a field I created in drupal.
Yes I do understand there's a comment module that's built into core but I'm looking to create something similar. Or even as similar as a twitter feed. A user just goes to his or her page and has a box for them to write out a small message.
Can someone point me in the right direction as it pertains to Drupal.
Best,
V
For data input, websites usually use forms. Drupal provies an Form API that you use to create forms and process their submission. You then need to process the submitted data and store them in the database. For that you will need Drupal's database abstraction layer. Finally, you will need to build page to display the form and the stored data. A page is the result of a controller method binded to a route. That result can either be a render array (see the Theme and rende for more information), or a Symfony Response object.

Passing data from one element to another on the same html page [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hi I am trying to develop a mobile app. The problem I am having is this, when the user fills in a form on the html page I want the data to get written to an unordered list on the same page. I want when the next user fills data for that dat to get written to the second list item in the list and so on
.
Thanks in advance for any help you may be able to give with this problem
If I understood correctly, you're trying to make an app that stores the data of each submitting of the forum and returns them to all users that come across the page?
For such tasks you'll need, at least:
A web server that runs PHP, Python or other language to your liking*;
A database to connect the server-side with (MySQL or PostgreSQL usually);
What you need to do:
Learn about HTTP POST and basic SQL input/output if you haven't;
Learn AJAX if you haven't;
Store the user input in the database and have a server script retrieve it on call;
Update the dynamic page bit (the unordered list) with AJAX (loading a XML file with the PHP script that writes the database info into it should do) every minute or so using a timeout function.
I'll post links to all I've mentioned in a minute.
*NodeJS is getting popular for being asynchronous (making it easier for dynamic pages to interact with the server) and allowing programmers to use the same language client- and server-side, but I have never tried it to tell you how it fares. Edit: says John NaN: NodeJS is not recommended. Again, I don't know it myself; that is why it's on a note and not upper in the post. Good luck!
*Bonus note: don't trust W3Schools most of the time. The AJAX tutorial I linked to, however, isn't that bad and it's easy to follow.

Create a button for a user to create a screenshot [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am hoping someone may have a solution for a situation I am in. I have created an online web map tool that leverages javascript, html5, jquery, and CSS to distribute information such as zoning and streets to users. The problem I have run into is getting the page to print once the user finds what they are looking for. I have tried:
Using CSS to create a print setup that works across multiple browsers but it does not work correctly and the mapDiv does not print correctly as it does not center on the map but instead focuses on only a certaing portion of the Did.
Using html2canvas to print the canvas, but it will not print the mapDiv, but will print everything else.
Using fireshot api for creating the screenshot, but it will only work in Friefox from what I have seen.
Using the ESRI print javascript api tool, but it does not generate the desired result either.
This being said, ultimately what I would like to create is a button which will screen capture what the user sees and allow them to save it to their own disk and the print. I know javascript and html does not natively have this functionality because of potential security risks and the like, but I was hoping someone here may have found a plugin which works to create a screen capture. I am okay processing this on my server if needed, but in essence I need a way of doing a Alt+PrtScr without having the user do this themselves so they capture what they are seeing.
Any and all thoughts are welcome. Also explanation of how to leverage any plugins would be helpful as well as I am a bit of a rookie at this aspect of coding and want to make sure I enable this tool properly. Thanks!

Categories

Resources