How can I make the sender's name in standard CMSimple_XH mailform mandatory?
There is only the sender's email, the message and the captcha mandatory.
Name in mailform mandatory
Moderator: Tata
Name in mailform mandatory
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Name in mailform mandatory
Basically you can replace this line with:
Code: Select all
if (!$this->mail->isValidAddress($this->sender) || $this->subject == '' || $this->sendername == '') {
Christoph M. Becker – Plugins for CMSimple_XH
Re: Name in mailform mandatory
One more thing.
The Email and the Subject fields go red framed on Submit if empty. Where is this defined? If the Name field is empty, the warning is there on submit, but the field is not red framed. No big problem, but anyway, the uniformity would be better.
The Email and the Subject fields go red framed on Submit if empty. Where is this defined? If the Name field is empty, the warning is there on submit, but the field is not red framed. No big problem, but anyway, the uniformity would be better.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Name in mailform mandatory
The red frame is set by the browser when the field is "required" and empty or has a wrong entry.
If the field is not "required", the system does not check it and does not output a message.
Re: Name in mailform mandatory
That's known. But how to tell the browser, that this field is mandatory? I have changed the line as cmb wrote. But the field seems to be ignored by the browser, anyway.
EDIT:
Hopefully found (required="required"):
EDIT:
Hopefully found (required="required"):
Code: Select all
$o .= '<div>' . "\n" . '<label for="xh_mailform_sendername">'
. $tx['mailform']['sendername'] . '</label>' . '<br>' . "\n"
. '<input type="text" class="text" size="35" name="sendername"'
. ' id="xh_mailform_sendername" value="'
. XH_hsc($this->sendername).'" required="required">' . "\n"
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Name in mailform mandatory
This line at the end extend with the red word:
XH_hsc($this->sendername).'" required>' . "\n"
(Untested)
(But - just tested. Seems to be working.)
you were faster
Last edited by frase on Sat Jun 01, 2019 10:49 am, edited 1 time in total.
Re: Name in mailform mandatory
You were faster, I have found it and it works .
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.