| View previous topic :: View next topic |
| Author |
Message |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Thu Oct 03, 2002 5:11 pm Post subject: weird behavior when displaying submitted event |
|
|
Hi,
I added 6 fields using the instructions outlined in the thread "Instructions for adding a field & making it show on myca", but had some trouble making the new fields show up properly when the event is submitted and the screen shows the submitter the information they submitted. Everything gets submitted properly and goes into the calendar_Validate table, etc., it's only having a problem displaying the new fields in this one page.
I narrowed it down to the add_to_validate.php page in the "display the submitted event to the user" section. I had copied and pasted the "title" row, and modified the field name to match the field name in the db, so that it read:
| Quote: | | echo "<br><b>". $LANG["where"] .":</b> ". stripslashes($db_validate[V_WHERE_ROW][2]) ."\n"; |
It kept showing only the time, subject and description, but not my new fields. When I changed the new line to match the description line, all of the new fields displayed properly:
| Quote: | | echo "<br><b>". $LANG["where"] .":</b> ". stripslashes(nl2br($where)) ."\n"; |
What is the purpose of having it look up the info in the calendar_Validate table (which I assume is what the $db_validate is for immediately preceeding the field name) rather than putting in newline breaks, as is the case in the description line? Will it hurt anything to use the nl2br rather than $db_validate, and under what conditions is it necessary to use each one?
Thanks |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Thu Oct 03, 2002 5:18 pm Post subject: |
|
|
Is your 'where' field a textarea input form element that can contain multiple lines of text? If so, that could explain what you're seeing.
I'm not sure off hand why not converting to newline breaks on a field that requires it would keep things from showing up, though. Seems it would just run all the lines together. Where you're using $where, did you assign that value from $db_validate[V_WHERE_ROW][2] like is done for $description?
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Thu Oct 03, 2002 7:23 pm Post subject: |
|
|
Only the $description is set up to have multiple lines of input.
The description has the format
| Quote: | | echo "<br><b>". $LANG["text"] .":</b> ". stripslashes(nl2br($description)) ."\n"; |
I don't see anywhere in add_to_validate.php that assigns the value from $db_validate for $description. I assumed it used whatever value it may have had in a buffer.
If it is supposed to assign values from $db_validate, how is it displaying the correct $description, and now $where, using the above quoted syntax? I have checked the calendar_Validate data immediately after submitting the event, and all of the data is in there. It's just behaving a little unexpected when it goes to display the user's submission. It works just fine with the one line modified like this, but I'm not sure why it's behaving like this.
Could it have something to do with the $where line being the first line after the multi-lined $description? |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Thu Oct 03, 2002 8:05 pm Post subject: |
|
|
I don't know which MyCalendar version you're using, but you should see the following around line 75 in add_to_validate.php:
$description = $db_validate[V_DESCRIPTION_ROW][2];
and right below it:
$db_validate[V_DESCRIPTION_ROW][2] = nl2br($db_validate[V_DESCRIPTION_ROW][2]);
One is for displaying what has been submitted, the other is for updating the database. (I split the two up to avoid re-processing the already processed data for the confirmation.)
| Quote: | | Could it have something to do with the $where line being the first line after the multi-lined $description? |
I can't think of any reasons why the two would be affecting each other. There's probably a simple solution hiding somewhere, but I'm not seeing it yet...
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Thu Oct 03, 2002 8:36 pm Post subject: |
|
|
I'm using 2_20_b4. The $db_validate wasn't in that line, and there's only one line. I just checked my original, unmodified file to make sure I hadn't inadvertantly mutilated it in my attempts to get it to work!
Could that be the problem then? Perhaps if that line is missing, it's bombing at that line because it's expecting something that isn't there? If the line in my file only reads (nl2br($description)), and (nl2br($where)), how is it populating the fields on the user-submission readout? Would that be simply returning the last-known value for that variable?
Should I put the two lines you listed below into add_to_validate.php (and also for $where)?
Thanks, |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Thu Oct 03, 2002 9:12 pm Post subject: |
|
|
I see it now, it's farther up than the section I was referring to. My bad.
Should I put in a similar section for each of the new fields I put in? |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Thu Oct 03, 2002 9:33 pm Post subject: |
|
|
You shouldn't need to add that in unless it is a multi-line field like Description. That section up above is for things like formatting the description, assembling the day from the month/day/year components, calculating the day of week, etc. Unless your added field fits any such non-standard criteria, the only explanation I can think of for the behavior you're reporting is a minor error somewhere in your customization.
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Thu Oct 03, 2002 9:50 pm Post subject: |
|
|
Okay. Can you think of any reason why I should NOT leave it like this, even though the $where isn't like the others, and there is no $db_validate line for it anywhere? It works, but I don't know PHP enough to know if it will cause any problems.
 |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Thu Oct 03, 2002 11:12 pm Post subject: |
|
|
Well, I never like leaving anything as is that I know isn't working properly, but if you're sure it is getting properly submitted to the Validate table and admin validation of the event works just fine, then it may not be worth worrying about something that is only a confirmation display.
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Fri Oct 04, 2002 10:32 am Post subject: |
|
|
I'm the same way. I'll check out allof my other files that I modified and see if I configured something goofy somewhere.
Thanks for all your help! This program is awesome, and the support has been the best of any program I've ever bought! The only problems I've had so far are due to me trying to customize it.
bongo. |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Fri Oct 04, 2002 12:23 pm Post subject: |
|
|
Thanks for the nice feedback.
| Quote: | | The only problems I've had so far are due to me trying to customize it. |
Of course, my goal is to make such customization as painless as possible, which obviously is still a ways from fruition. With so many distinct duties for each field such as add/modify forms, confirmation, and day displays, it's a challenge to come up with a system that centralizes the configuration of each such field any better than the current $db_xxx array setup does.
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Fri Oct 04, 2002 1:20 pm Post subject: |
|
|
I know. I began thinking of how to write a shell script to ask for the field name and automate putting it in all of the required places, but then just trying to figure out how to have it put it in with the correct numbers in config.php made my head hurt.
Great job, though. I know all you read in the forum is the problems people are having. I hope you get complimentary email, because the program is great.
bongo |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Fri Oct 04, 2002 3:41 pm Post subject: |
|
|
Don't suppose you'd be interested in writing up a testimonial based on the above comments?
| Quote: | | I began thinking of how to write a shell script to ask for the field name and automate putting it in all of the required places |
Something like that has the added risk of making important configuration files writable, which I figure is a risk not worth taking unless absolutely necessary.
Cheers,
Dan |
|
| Back to top |
|
 |
bongo Window Shopper

Joined: 04 Oct 2002 Posts: 17
|
Posted: Sat Oct 05, 2002 11:56 am Post subject: |
|
|
Sure, I think it's a great program!
I think if only an administrator has access to the files anyway, and they run the script, what's the difference if they run the script as owner or if they hand modify the files as owner? Maybe have the script make the files writable, do the deeds, then reset permissions again before moving on to the next file.
...just a thought... If I come up with something that works for me I'll email it to you.  |
|
| Back to top |
|
 |
Dan Admin / Developer

Joined: 19 Feb 2001 Posts: 2057
|
Posted: Mon Oct 07, 2002 1:12 am Post subject: |
|
|
That's a good point. Assuming your PHP setup allows you to change file permissions on the fly (not a safe assumption, as mine doesn't, presumably due to safe mode), that would provide a good way of protecting the script that is allowed to set write permissions.
Cheers,
Dan |
|
| Back to top |
|
 |
|