We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Where is new Submit('sendVerifyMail') defined? | Forum

Marina Bircher
Marina Bircher Apr 10 '15
How can I make my own Submit button? I really couldn't finde 'sendVerifyMail' in the whole project, only in ow_system_plugins\base\controllers\email_verify.php ! where can I find this??


$submit = new Submit('sendVerifyMail');


I want e second Form in email_verify_index.html for verifying mobile numbers! 


this is my code for the second Form I defined in email_verify.php

$mobileVerifyForm = new Form('mobileVerifyForm');

$mobileHidden = new HiddenField('mobileHidden');
$mobile = new TextField('mobile');
$mobile->setLabel($language->text('base', 'questions_question_mobile_label'));
//$email->setRequired();
// $mobile->addValidator(new EmailVerifyValidator());
$questionData = BOL_QuestionService::getInstance()->getQuestionData(array( OW::getUser()->getId() ), array('mobile'));
$mobile_nr = $questionData[OW::getUser()->getId()]['mobile'];
$mobile->setValue($mobile_nr);
$mobileHidden->setValue("1");

$mobileVerifyForm->addElement($mobile);
$mobileVerifyForm->addElement($mobileHidden);

$submit = new Submit('sendVerifyMail');
$submit->setValue($language->text('base', 'email_verify_send_verify_mail_button_label'));

$mobileVerifyForm->addElement($submit);
$this->addForm($mobileVerifyForm);



and I brought it in the view, in email_verify_index.html - But now, in email_verify.php how can I see which Form has triggered the isPOST method?


Thank you for helping.


-------------------------

I love oxwall.org team they hav not blocked me for no reason since 5hours! new record! 

dave Leader
dave Apr 10 '15
check out the following files... 


ow_system_plugins/base/bol/question_service.php  lines 1427, 1434, 1457


ow_static/plugins/admin/js/main_settings.js   line 9


ow_system_plugins/admin/views/controllers/settings_index.html  line 82


you already know about the email_verify.php  line 90


ow_system_plugins/base/mobile/views/controllers/email_verify_index.html line 13


ow_system_plugins/base/views/controllers/email_verify_index.html  line 7


Dont know what search utility you use but Agent Ransack is your friend, it has saved me countless hours.   


Hope that helps. 




Marina Bircher
Marina Bircher Apr 13 '15
Thanks Dave, it helped :)


In email_verify.php, how can I see which Form has triggered the isPOST method? Have I to check a hiddenField? I dont think you can check something like:




if ( OW::getRequest()->isPost() && FormnName == 'emailVerifyForm')




THX

The Forum post is edited by Marina Bircher Apr 15 '15
Marina Bircher
Marina Bircher Apr 15 '15
How can we get two different forms in one view and check which one has been submitted? 



Nickolay
Nickolay Apr 17 '15
Just create an additional hidden input in each form with different values and check it on form processing. Or it can be your submit inputs as well if you assign them different values.
Marina Bircher
Marina Bircher Apr 17 '15
Thanks it worked with the additional hidden input. 



if ( $emailVerifyForm->isValid($_POST) )
{
$data = $emailVerifyForm->getValues();
$email_hidden = htmlspecialchars(trim($data['emailHidden']));

if($email_hidden=='email'){
//here send the email!
$this->redirect();
}else{
//erro
}
}

if ( $mobileVerifyForm->isValid($_POST) )
{
$data = $mobileVerifyForm->getValues();
$mobile_hidden = htmlspecialchars(trim($data['mobileHidden']));

if($mobile_hidden=='mobile'){
//here send the SMS!
$this->redirect();
}else{
//error
} }


THX


Marina Bircher
Marina Bircher Apr 17 '15
ACTUALLY there is no need for the extra hidden fields:


use isset($_POST['ButtonValue']) to find out which button was clicked:

if ( OW::getRequest()->isPost() && isset($_POST['ButtonValue']) )