Hi.
I've modified the PasswordEntry.tpl template for use on an age-sensitive gallery; message along the lines of "You need to be over 18...". This is working fine but I want to add a "Cancel" button alongside the "Submit" button so that people who don't want to proceed will get returned to the page from where they came.
I've copied the relevant lines from the "Login" screen so that the PasswordEntry.tpl file now includes:
----------
<input type="submit" class="inputTypeSubmit"
name="{g->formVar var="form[action][cancel]"}" value="{g->text text="Cancel"}"/>
----------
This doesn't work, however. If I click on the button, I remain on the password entry form. Having looked at the generated code on the login screen I have now also added the lines:
----------
<input type="hidden" name="g2_return" value="/main.php?"/>
<input type="hidden" name="g2_form[returnUrl]" value="/main.php?"/>
----------
(I've used hard-coded URL's as I haven't worked out which variable contains the URL of the preceding page)
Again, this has made no difference.
Does anyone know what's missing in the code to make the Cancel button work? Alternatively, does anyone have a module that performs this function?
Many thanks.
Posts: 14
Typical; you post the question and then make progress on this issue!
I've modified the PasswordEntry.inc file to include the relevant code to process a "Cancel" button:
----------
} else if (isset($form['action']['cancel'])) {
$results['return'] = 1;
----------
Any advise on the dynamic setting of "g2_return" would still be appreciated.
Thanks again.