Forums

how to redirect to new entry form and test it

kgriffin 30 Oct, 2020
I have a Chronoform with two pages. The first page is a form for users that already have a database entry based on the particular where conditions on Read Data. The second is for users that need to create a new entry. On the Read Data for the first page I have a redirect to the form for the new entry on failure, with id set to empty. When I test the form by clicking Front View, it only ever goes to the first page.

Are the Read Data conditions not activated when previewing the Front View? Do I need to test this as part of the site? Or am I doing this wrong, and if so, how do I do it correctly?
Max_admin 30 Oct, 2020
Try to set the Page Group type to "Standalone" instead of Sequential, does that work ?

Because when it's sequential, the pages order is forced and all fields have to be checked!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kgriffin 31 Oct, 2020
Whew. Sorry for the delayed reply. I have been testing and finding issues that interfered with testing this.

Anyhoo, unfortunately your suggestion does not work. However, one thing I did take time to do this time around is to enable the system debug, and it looks like when in Frontend preview mode, the user id is set to '0', instead of using the Super User id, which means I need to test it on the site, which I did. I still got the same behavior though: no redirect when failing to find a record.
Max_admin 31 Oct, 2020
The user id will be 0 if you are not logged in!

What if you move the redirect outside the Read Data, does it work ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kgriffin 31 Oct, 2020
I tried this two different ways, keeping the Read Data and putting the Redirect outside of it, and deleting the Read Data and only having the Redirect, and both times I got the following error in the browser, even after clearing all caches I could possibly think of:

​This page isn’t working
xxx.xxx.org redirected you too many times.
  • Try clearing your cookies.

ERR_TOO_MANY_REDIRECTS

I also experimented with just the Read Data to see if I could get a simple error message on success or failure, and I never got anything.
kgriffin 01 Nov, 2020
Oops. Scratch all that. I had for some reason switched it back to Sequential, which caused the loop. Standalone works fine with the Redirect outside the Read Data. This means something is up with success and failure.
kgriffin 01 Nov, 2020
Gave up on the redirect, tweaked the form to handle both new and current applicants and now have a sequential form with a page for saving data. The only problem is the submit button does nothing but do field validation. The Save Data action on the Save page is not activated. When I manually put in the Save page URL in my browser, it works as expected, giving me the failed save message, so I have no idea what I am doing wrong.
Max_admin 02 Nov, 2020
Try to use the Page Loader action instead or the Redirect, if the Read Data fails, Load a different page, but that page should be either a standalone page or the start page in a sequential page group, because you can not skip pages in a sequential page group!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kgriffin 03 Nov, 2020
Right now this is how I have things set-up and the behavior I am getting:

The set-up:

There are two page groups.

First page group of form has a standalone page, which lets me know whether or not a record has been found. There are no fields, just a Read Data with a WHERE condition and "Set Models Data".

For found in the Read Data I have a message, "Found!", and a redirect delayed for 10 seconds so I can see the message and check the debugger output, with the "aid" set to the record's "aid". For not found, I inserted a message, "Not found!", and a redirect delayed for 10 seconds with the "aid" set to empty for Not Found.

Both redirects go to the first page of the second page group.

The second page group has two pages and is set to sequential. The first page is the form (with Read Data). The second page is the Save Data with a Variable Request Data for the userid if the "aid" is empty and a redirect to the homepage of the site for a successful save.

The menu item has "aid" set as the custom parameter.

Results:

There are problems right off the bat. There are NO records in the table and yet "Found" is triggered for the initial Read Data in the first page group. The debugger confirms the "aid" and the data array are empty. I get redirected to the next page group and the form after the allotted 10 seconds.

I fill out the form, and click the submit button, but I get NO response. I am not sent to the next page of the sequential form and thus the Save Data is never activated.

I think I need someone to look at what is happening directly and help me figure out what is going wrong. Is this a possibility?

(BTW: I took this set-up off of the Article List demo, which also seems to have some bugs in it. The table only shows the title of the article, and not the alias or the link to edit it, and when I create a new article, on submit a new record is created, but no data is saved).
Max_admin 04 Nov, 2020
how this app should work ?

first page > check a record exists ? yes : show a list of records, no : go to the form then save and go to the list

correct ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kgriffin 04 Nov, 2020
I am looking for a single record, not a list. That record was not found, and yet "Found" was triggered. That is not how the app should work. If I needed to go to two different pages depending on whether the record was found or not, like I was originally trying to do, I would be taken to the wrong page. As I have said multiple times, success and failure for the read data action is NOT WORKING CORRECTLY.

But that is just the first problem. The second problem is submit is not working. I am not being taken to the Save Data page, which renders the app completely useless.

I think this conversation is not helping me and I am going to try to figure out who else to talk to about this.
Max_admin 05 Nov, 2020
Hi kgriffin,

I found the bug related to the found/not_found of the read data and sent you a patch file, it was triggering found when there were no errors but also when there were no records.

The 2nd issue is not clear, of course the submit should be working fine, usually a problem with your form config is causing this, I asked for a form backup!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.