CMTV
Well-known member
I have a page with the button "Add dependency" and hidden input field.
The button opens a modal:
The modal consists of one textbox input field and submit button:
How can I pass
I also have to perform some checkings and display errors if there are some. That is why I can't use
Basically, how can I check
HTML:
<xf:button href="{{ link('UP/trophies/addDependency', $trophy) }}" class="button--add" icon="add" overlay="true">{{ phrase('UP_add_dependency') }}</xf:button>
<input name="page_dependencyValue" type="hidden" value="">
The button opens a modal:
PHP:
$viewParams = [
'trophy' => $trophy
];
return $this->view('XF:Trophy\AddDependency', 'UP_add_trophy_dependency', $viewParams);
The modal consists of one textbox input field and submit button:
HTML:
<xf:title>{{ phrase('UP_add_dependency') }}</xf:title>
<xf:form action="{{ link('UP/trophies/addDependency', $trophy) }}" ajax="true" class="block">
<div class="block-container">
<div class="block-body">
<xf:textboxrow name="dependencyValue"
label="{{ phrase('UP_trophy_link_or_id') }}"
hint="{{ phrase('UP_trophy_link_or_id_hint') }}" />
</div>
<xf:submitrow icon="add" submit="{{ phrase('add') }}" />
</div>
</xf:form>
How can I pass
dependencyValue
from modal textbox field to page_dependencyValue
field when clicking "Submit" button without reloading the page (without $this->redirect(...)
)?I also have to perform some checkings and display errors if there are some. That is why I can't use
class="js-overlayClose"
as it always closes the modal even if there are some errors (it shows the error but closes the modal).Basically, how can I check
dependencyValue
value on backend when clicking "Submit", then close the modal and pass the value of dependencyValue
to page_dependencyValue
without reloading the page?