I'm new to reactjs, i wanted to post the message through the fetch method successfully, as i 've raised the query but the solution didn't worked out for me and given negative votes for the query. I'm writing my problem because i have gone through similar links and i have tried but not getting expected output. Sometimes it's working fine and the next day it is showing error in res(json) line. And want to clear the message after posting but when i use this link solution "How to clear the input after posting the data through fetch and making the code execute successful" sometimes the message is getting disappear and sometimes message is not getting posted. Anyone help me in this? thanks in advance.
You need to use the value from the state inside input to be able to clear it:
<input
className="sendMessage"
onChange={this.handleChange}
name="body"
value={this.state.body} // Add input value
/>
Related
I'm new to react and i've written my query for this message list for "How to change color of the left aligned text?" and i've got the solution but now my query is - If i get a new message then it should display down the new message in the conversation but instead of showing the updated message, It is scrolling upwards and showing older message first.
Can anyone help me in this? Thanks in advance for helping.
I will recommend this library react-scroll-to-bottom. You can see the working demo here.
Trying to do something which is very simple but am getting strange results.
I have an image stored as an attachment which I want to display in a VF Page.
If I do this it works fine
<apex:image url="{!URLFOR($Action.Attachment.Download,'00PR0000008Q3YmMAK')}"/>
However that was for testing purposes that I hardcoded the id. If I try reference the Id in the object then it fails. Even though the value contained in the object is exactly the same as above.
<apex:image url="{!URLFOR($Action.Attachment.Download,model.PreviewImageAttachId)}"/>
When I load the page I get an error in URLFOR param!!!
I thought my problem was because model.PreviewImageAttachId was a String and not an Id so I created a wrapper to return it as an Id - same error.
I then decided Salesforce must have some strange requirement that you can only pass in the REAL object so I did that and passed in model.Attach.Id and it still fails!!
Please can someone explain this to me and more importantly suggest a solution??!?
Once again if I output to the page
{!model.PreviewImageAttachId} i get 00PR0000008Q3YmMAK
So I just cant explain this!
Thanks!
My bad...
Was using apex:repeat and turns out SOME of the id values were null.
Hence the error
Going through a Forms Angular2 tutorial. And I get to a part where my code isn't doing what the tutorial explains should happen. So before I reach a conclusion that Angular2 Beta has a bug maybe someone could try this out.
It's a problem around the 2 way data binding of the "Powers dropdown" where a user input change isn't being reflected in the model. The 2 way binding occurs with:
<select class="form-control" required [(ngModel)]="model.power">
EDIT:
See full code here
When you run the code keep an eye on the "{"id":18,"name":"Dr IQ","power":"Really Smart","alterEgo":"Chuck Overstreet"} " output. You will notice that it changes as you edit the 2 txt inputs but that changes to the dropdown are not reflected in this output.
I have one problem with form and ng-form.
Here is the sample https://jsfiddle.net/HB7LU/12182/
What I would like to do is display group messages.
eg. If I have 3 items and any are invalid then show the error message outside of ng-form.
I don't want to repeat every error message under input. If 3 inputs with name 'number' is invalid, I want to display only one message.
Does anyone have any ideas how to achieve this?
I figure it out.
https://jsfiddle.net/HB7LU/12189/
it works with angular 1.3+
but if someone have better solution I will like to see it.
Thanks.
I am facing a strange problem in cakePHP.
The issue is when ever i submitted a form it results a blank screen.
before submission the action work fine.
Do any body have any idea on this issue.
Thanks in advance
There are a few things to help you check what is happening.
1- Check config/core.php and set DEBUG to 2. If you are getting a blank screen, this may not do anything.
2- Check your controllers / models. Make sure there is no blank lines after the ending ?> php tag. This could also cause blank screens.
3- Check syntax of your code. Try commenting out code to see if there is some code that may be improperly formed causing syntactical outages.
You can try posting your code so we can take a look. Maybe we can eyeball what is occurring.