I would like to loop the form, so that after a submit, it just starts over again.
If I just use 'event loop' it does start over, but all the values are kept, how do I clear them from the form?
And just like I can report an error with "$form->validation_errors[]" I would like to give a report of 'ok' as well, but what function do I use for that?
Hi fribse,
You can set the Form URL as a ReDirect URL. I'm not sure if that will stop the data republishing though :-( You might need to add a Custom action to clear the $form->data array just before the ReDirect URL action.
Bob
I've changed the event loop to a redirect user, and that clears the form nicely.
But when I give an error, I would like it to keep the form data, and give the error, well, it doesn't, it loads the first row in the database in the form, and gives the error.
How do I just show the error, and return to the form again?
Hi fribse,
What actions do you have set? Can you post a screenshot? I'm a bit baffled by how it would get a record from the database to show.
Bob
This is the the code for the submit button, it's the same form that you're helping me with another problem.
[attachment=0]capture.png[/attachment]
Hi fribse,
I'm not clear why you have a DB Record Loader in the On Submit event? Is this to get info for the calculation? If so then it needs to be before the Calculation Custom Code action.
I'm even less clear whay you have a second DB Record Loader nested inside the first one. This will work but it's neater to put it after the first one.
Bob
Hi
Sorry, I know it's a bit messy.
The problem comes from the calculation not doing what it's supposed to do, ie. update the hidden fields, so they are updated in the db.
The logic behind the form is:
Enter a week number
Enter a day (it's a select box with two choices), day-a gives a value of 0, day-b gives a value of .5
Enter four numbers.
The logic then add's the day value to the week number, this way I can still see the weeknumber, but I can have two values for every week, and it's still sortable in the right order.
This value is stored in the db via a hidden field.
The four numbers are stored individually, and a total is calculated and stored in the db via a hidden field.
The reason for the double db load is because of the problem in the calculation.
I want to make sure that I don't get multiple entries for the same week and day.
To check this, I would compare the calculated value (week+day) to the field in the db.
But as the calculation doesn't work, I then made a comparison first between week value, and if that is a hit, I then compare with the day value.
I have no idea on how to check two fields in one db load, that's the reason for the nested check.
I'm giving up on this approach, and I've started over.
I'm going to create a new thread for that.