50 Posts
rtlehr
5 years ago
Topic

Hey all,

     Ok, I'm sure this is just something I'm missing, but it's driving me nuts (and this has probably been answered, but I'v looked everywhere.).  I'm using the latest version SEBLOD and Joomla 3.8.12.  I have a Submit button, with the Task of Save & Redirect.  I select a page from the menu and when I hit the submit button on the form, the page just reloads itself (it breaks because I have some variables in the URL that are not getting passed to the form).  I'm tryingto get the page to load a "Thank you for submiting" page (or any page for that matter) but no matter what Task I try, the form just reloads itself.  

     I have to be doing something wrong, right?

Thanks,

Ross

Get a VIP membership
4229 Posts
Kadministrator
5 years ago
0
Level 1

Check if there are any javascript errors on the page, those might prevent button from working correctly.

50 Posts
rtlehr
5 years ago
1
Level 1

No errors show up in the console window.  The only error I get is after I submit and the form reloads itself without the URL parameter some of the SQL needs.

Thank you,

Ross

4229 Posts
Kadministrator
5 years ago
0
Level 2

I just tested and Save&Redirect works fine for me. Might sound silly,  but double-check if you are changing things at the right place e.g. the right content type and the right form (site vs. admin) etc.

50 Posts
rtlehr
5 years ago
0
Level 1

I've isolated the problem to some code. the story....

I'm creating a way for people to post an event and let people register for it.  In the form that reserves the person spot, I have some restrictions set using the SQL plugin.  The restriction checks if the event a person is reserving the spot for actually exists, if not, shows a "event does not exist button


SELECT id FROM #__cck_store_form_orchard_event WHERE id= $cck->getValue('orchard_event_id');

The event planner can also set an option that allows them to approve an attendee before they are allow to come.  I'm using a BeforeStore to check and manage this.  When the user registers for the event, I'm checking the event table to see if the user needs approved by the and if so, sets the information in the attendees record.


// Check to see if approval is required
$dbGetApproval = JFactory::getDbo();
$queryApproval= $dbGetApproval ->getQuery(true);
$queryApproval->select($dbGetApproval ->quoteName('orchard_event_require_attendee_approval'));
$queryApproval->from($dbGetApproval ->quoteName('#__cck_store_form_orchard_event'));
$queryApproval->where($dbGetApproval ->quoteName('id') . ' LIKE ' . $cck->getValue('orchard_event_id'));
$dbGetApproval ->setQuery($queryApproval);
$resultApproval = $dbGetApproval ->loadResult();

//Set the correct information
if($resultApproval == "No")
{
$a = "Yes";
}
else
{
$a = "No";
}

//Save the info into the atendees row
$name = $fields['orchard_event_attendee_approved']->storage_field;
$table = $fields['orchard_event_attendee_approved']->storage_table;
$config['storages'][$table][$name] = $a;

The $cck->getValue('orchard_event_id') is coming from the URL in a param /index.php/reserve-event-seat?eventid=65 I have the Live Value set up to capture the URL param.


If I remove the code, the submit buttons work fine, but then I don't get what I need.  I need to figure out what is wrong with the code. 

Thanks, for your help.

50 Posts
rtlehr
5 years ago
0
Level 1

ok, I got it... 

The problem was my BeforeStore code.  I was trying to get the event id wrong.  The below code works

// Check to see if approval is required
$dbGetApproval = JFactory::getDbo();
$queryApproval= $dbGetApproval ->getQuery(true);
$queryApproval->select('orchard_event_require_attendee_approval FROM #__cck_store_form_orchard_event'); $queryApproval->where("id = '" .$fields['orchard_event_id']->value . "'");
$dbGetApproval ->setQuery($queryApproval);
$resultApproval = $dbGetApproval ->loadResult();

if($resultApproval == "No")
{
$a = "Yes";
}
else
{
$a = "No";
}

$name = $fields['orchard_event_attendee_approved']->storage_field;
$table = $fields['orchard_event_attendee_approved']->storage_table;
$config['storages'][$table][$name] = $a;

Get a Book for SEBLOD