I am trying to render a data from webhook to a form label say "PRO®AIN" is retrieved to a form. But it is rendered as PRO®AIN where ® is considered as ®. I know I can use encoding by using & ; instead & but I cannot do this change to backend while updating this data.
My question is, how do we render the data to the html page by ignoring such cases. I would like to display as like from backend.
I wonder the same above text is rendered properly as like in grid
Related
I have a webpage where user will enter his details and then on click of submit, I am invoking a service through ajax call for saving it in db. Then I capture the response from the service written using java REST webservices and display it in the webpage. I am displaying the message "Details saved successfully".This message is read from a properties file in my java service layer and passed back to the web page. I currently need to change font color to the text being returned.
I tried adding the following <font color="red">Details saved successfully</font> to my file data and the same text is passed from service layer. IN the web page I see that the font color is not rendered for the text and that the entire above text with html tags is getting displayed in webpage. I am using $scope.status=response string in js page and in html page, I am rendering as <div id="test">{{status}}</div>
Is there any way to render the html tag when we pass it as string from properties from service layer to js page. My goal is not to change the existing html code and have the html tag rendered when read from properties file and passed as string from services.
Thanks.
Letting the user submit data containing HTML that is rendered when displayed can be a security risk. Users can be very creative in the HTML code that they "inject" in your application. There are lot of sites where you may find more information about that vulnerability.
When you need to add some markup, you might look at alternative markup rendering methods, for example BBCode or MarkDown.
As the title suggest: Is it best practice to create HTML elements from inside external POST file or from within calling file?
Specifically, I am creating a wizard with PHP and jQuery. I am looking for help with fundamentals of structure when it comes to proper usage of passing data to an external page to process it.
The process goes as such: The user is on a page, "wizard.php". First, Step One is displayed, which asks them to enter a title of their Project in an input text element. A "Next" button is displayed as well.
Once this is done, the user clicks "Next", and a $(.post) method is invoked, and in an external file (wizard_process.php), the "title" is sanitized and added to the database.
Now, once the title has been sanitized, I want to display to them "Step Two", which is going to provide the Sanitized Title that they have input in the previous step, a few more input checkboxes (all inputs that are needed for Step Two), and other criteria for them to fill out.
Do I want to
a) print the HTML elements from within the "wizard_process.php" so that it is displayed on the parent, "wizard.php", page? (it would be a <h1>$sanitized_title</h1>) along with the next set of checkboxes and inputs. It would include all elements of Step Two coded as HTML in the wizard_process.php.
b) send back json data (not in HTML form, but in json form) and only use the external php file (wizard_process.php) to sanitize and add to database and return json data. {sanitized_title: $sanitized_title} and then create the HTML element to display that data from within the calling jQuery function? (wizard.php)($(".successresponse").html(result);) and then create the next set of checkboxes (Step Two inputs) from the calling page (wizard.php) as well?
Or do I want to
c) send back json data (not in HTML form, but in json form) and then make already created elements visible. For instance, having all the textboxes, questions, checkboxes, and drop downs from the entire wizard hard-coded into the HTML file, with the hidden option = true until we reach that phase of the wizard.
I know each of these is possible, but being a PHP coder, my first instinct would be to use the wizard_process.php as sort of a Controller/Model (MVC) so as to only process data, and not use it as the View. That means not actually creating the HTML elements inside that external post process file, but rather only return data to the calling function to then later format and display in HTML.
What would be the best way to handle this?
I'm trying to get data (taken from mongo) to display into a textarea.
It's purpose is so that I can edit data within the database without actually touching the database itself.
I can display the data within normal HTML tags but I'm pretty clueless on how to get it to display it within a textarea (or any other tags that allow me to edit and re-submit the new data)
I'm rendering with EJS, and so far, everything display correctly with
<%= text %>
I just need it to work within a editable text area
This should work:
<textarea id="yourTextArea"><%= text %></textarea>
I have a dropdown, on its change I need to load the contents related to it on the same page. Which I did using jQuery. Now the question is how do I make edits on this data and store it on my database. If I am wrong in using jQuery for loading my data then what else should I use? I am using PHP as my server side scripting language.
More detail -
Simply taking there a list of details I need to display as per the country you select, which I am displaying currently in a nice grid(textboxes)!
Now the data from this grid should be copied to another textbox on "EDIT" button click from where I edit them and store it in my database. I am not able to make the values copy into a another textbox
You could do this:
Display the data in some form of editable div, textarea, or other element.
Make a hidden field somewhere and when you display the data
Set the row id from your database to the hidden field
On your change event, grab the id from the hidden field along with the edited data.
Using Jquery/ajax, send that data to a php page that will save thee data to your database using the passed in id.
You could do that.
However, if it were me (and if you're not married to your current databse / mySQL etc..), I would use parse.com. The service is free up to a significant amount of usage (which Ive never come close to) and it really simplifies everything. See the below post if you're interested in that approach:
Save and retrieve user input from database with javascript?
I want inputRichText to display the output from the database which it was inputted earlier. The reason is the user get chance to input and display the data in same page. After inputting the data he can save it and retrieve it in the same inputRichText. Can you let me know if this work by in built or should i customize the js code? If so i would appreciate if someone have the js scripts. Also alternate idea are appreciated too. Right now i am using Icefaces component for inputRichText.
You can use the value attribute to set the content of inputRichText as string, also can use binding with the backing bean component of type InputRichText, but previous is more preferable way.
You can re-use the same object used for persisting data, to display the content later. It will be having the value fetched from the database & the same will be displayed as text. You have to initialize the string before displaying the page.