How to created input data with Drupal? [closed] - javascript

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.

Related

Getting updating in codebehind C# variable to asp.net [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
I wrote a small code in c# that reads files from the hard drive and outputs that info to a webpage using asp.net.
Information about those files is being changed in the codebehind.
I managed to create variables to read and display the info on the webpage, but they change only after a refresh. When I used setTimeout it would always read the same variable, leaving me thinking that the codebehind does not get re-executed.
How would it be possible to have them updated live without needing to refresh the entire page?
This is somewhat vague but if you want updates to the values on your page after loading, you'll need to use some javascript to grab new values and then more javascript to update values on your page.
There are some great frameworks out there. Unless you have a lot of front-end logic you need to perform through javascript, I'd keep it as simple as possible and throw jQuery in there for the AJAX calls (fyi, this is not the only solution, there are 10+ different ways to skin this same cat).
If you want a bit more efficiency, you could look into using SignalR - which wraps long polling or web sockets (depending on browser capability) on the front end and signals those subscribing pages on the backend only when changes have occurred to data.
Link: http://www.asp.net/signalr
There is no "right" answer to your question so the best I or anybody can do is guide you in a direction. Hopefully this answer helps you.

Using ASP classic to produce a label template for printing [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
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.

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.

What and the typical methods employed for UI bindings in an javascript/AJAX applications? [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
Some background
I'm currently building a predominantly classic web app (rather than a single page app) however the majority of my forms are AJAX.
I'm having trouble with binding the UI to my model - at the moment I have to explicitly:-
Tell each button that produces a form where to fetch the form from (it's delivered, pre-populated as AJAH)
Tell each form which content box it is tied to and must update on successful request
Tell the content box where to go to refresh itself
This is done at the moment by adding these properties to the respective objects that generate them and the url for fetching is constructed by the js.
The question
I'd really like to tie everything together and make it easier (maybe with events or something?) but can someone explain in simple terms the mechanics of how UI bindings are typically implemented?
Ok, so the way I decided to do this was to define a ContentBox.Update() javascript method so every content box on the page can just be told to update itself.
Then in my Form class on the server side I have a $form->bind($content_box_id); method which adds the binding to an array of bindings in the Form class which is passed to the javascript. Then once the form has been submitted, the array of bindings is looped over and the ContentBox.Update() method is called on each content box that the form is bound to.

Current 'Users Online' Script [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
What is the best script to use for showing the current visitors or guests Online?
Thanks!
As #Ryan Smith suggested, this greatly depends on the implementation details of the website. I'm sure that there is a off-the-shelf framework offering a storefront application with all the bells and whistles (such as the types of scripts you are mentioning); however, these can range anywhere from being free and open source, or very expensive.
Implementing a script like this yourself isn't very difficult. Assuming that you're keeping track of the users on the website in some form of data store (typically a backend database) you could do something like this:
When the page loads, fire a JavaScript that makes an Ajax request
Have the page that's the target of the Ajax request select a count of the number of rows in the table storing the active users. Return this result.
When the request completes, have the Ajax callback insert the number into the DOM in whatever place you'd like.
You can set this process to repeat at certain intervals so that the pages containing the script are dynamically updated showing a relatively up to date count of the number of users online.
I think it all depends on how your tracking who's online within your application.
Usually, when someone logs-in, you create a session for them that you could iterate through based on whatever language you are using.
You have to keep in mind that HTTP is a stateless environment, so determining when someone is online is largely subjective as to your opinion as to how long ago they logged in.

Categories

Resources