Troubleshooting help

CyborgPrime 21 Jun, 2017
I have a database full of award recommendations for members of my club.
I created a form that lets an administrator review the awards listings and make comments.

I run into a problem when I try to save the comments.
I created a custom script that formats the recommendations and has a link to save the comments.

The link is supposed to trigger a SaveComment event and that event is supposed to save the comment.

When I click the link, I get sent to the proper event and the id comes along, but the contents of the comments box comes over blank (like the data did not get updated after I changed the comments box).

3358 is the correct ID but how do i send the associated comment?

What's the best way to update the record? Custom script or db save or what?

I'm not sure how to send the comment along with the ID.
GreyHead 21 Jun, 2017
Hi CyborgPrime ,

I'm sorry but I don't understand what you are actually doing here. When you say 'link' do you mean a URL link or a form Submit button? If you are using a link then the only data submitted will be the variables in the URL.

Bob
CyborgPrime 21 Jun, 2017
Hmm- let me rephrase that then.

I love this product - I think it will be easy for users without form-making experience to create forms after I leave this position.

I guess my biggest difficulty with the program is what's the best way to do things? It's not clear which way we should go on anything more complex than a simple form.

I mean in my case - I don't even know where to start or where to look for the information - everything I find is only pieces of what I'm looking for.

For instance - let's say the use case is something like this:
1) End users add info to a database (done)
2) Administrators look into the database using various sorts (done - but did I do this the best way?)
3) Administrators add a comment to a record and save it (stuck)

For number 2 and 3 - I made a custom scripts that displays all the results and has a link (not a button) that sends the userId and comment to a page event that is supposed to update the record. Unfortunately the comment info isn't accessible for some reason - i guess i need to program a way to include the contents of the comments box.

But is this even the right way?

There must be a simpler way to do this - it's a common database function/feature. I'm not sure how to proceed? Do I make a page where the admin chooses a way to sort the data, then another page that displays the data? Will that handle a multi-records list?

Or do I have to use custom code to get this done?

Where do I go to find out how to do something like this?
GreyHead 22 Jun, 2017
Hi CyborgPrime,

I'm sorry but I don't see how your link sends the comment? Can you post an example link URL?

There are a couple of FAQS here which look at ways to Edit from a CC listing.

One of the problems and benefits of CC/CF is that they are very flexible platforms and it is possible to do almost anything - often in more than one way. But that very flexibility makes it much harder to understand or to document.

Bob
CyborgPrime 22 Jun, 2017
that's the problem - it doesnt send the comment - I'm not sure how to include the contents of the particular comment field - I coded the link so that it would send the id of the particular record, but I dont know how to get at the comment box for that record in order to send it to the update event..
CyborgPrime 22 Jun, 2017
I guess what 'm asking is an overview of the recommended way of doing this:

SHow a list of records
Allow a comment to be made and saved on one of the records

I got all the parts working for selecting a list of certain records, I'm just not sure how to proceed at the second part.
CyborgPrime 23 Jun, 2017
SO, it looks like the only way to display more than one record is by custom script - is that correct?
http://www.chronoengine.com/forums/posts/f2/t93311.html

And so let's say I manage to show mutiple records on the screen - how do I save a record i have updated?
CyborgPrime 23 Jun, 2017
So, I guess what I did wrong is I need to load each comment into a uniquely-named textArea so I can send that, along with the ID to the update record event?
CyborgPrime 23 Jun, 2017
i figured it out.. I'll write back with the solution
CyborgPrime 23 Jun, 2017
i've got it all working - except if I have a multiline entry in the textarea it gets saved in the database with the the carriage returns gone, so the next time I load the record, its all run together on one line.

in otherwords, if the textarea looks like this:

line1
line2
line3

it gets put in the database like this:

line1line2line3

any ideas?
GreyHead 23 Jun, 2017
Hi CyborgPrime,

There's an old post here that may help.

Bob
CyborgPrime 23 Jun, 2017
hm, except i used a javascript function to get the textfield contents and send it to the updateComment event.

So I guess I need to find a way to do that in javascript?

man, this is a pain, having to use 3 different languages to get stuff done.

ok so i made a custom script that lists all the records

each record has a button that triggers a javascript to get the contents of the record's textfield and send it back to the page, along with a updateComment event.

the updateComment event recieves the contents of the text field and updates the database.

I'm not sure where i'm losing formatting.. maybe when the javascript sends the comment back to the page it strips out the <br/> characters?
CyborgPrime 23 Jun, 2017
i got it to work with this:

echo" myComment = document.getElementById(myCommentField).value; \n";
echo " myComment = encodeURIComponent(myComment);\n";


But now when I read the database there are <br /> characters in the textarea.


Sooo close.
CyborgPrime 23 Jun, 2017
DONE!


Damn- that was brain-bending.
This topic is locked and no more replies can be posted.