[SOLVED] Email form

2 years 3 months ago #327993 by krileon
Replied by krileon on topic Email form
That's not going to work. You need to concat the userId into the URL. Example as follows.

window.open("index.php?option=com_comprofiler&view=emailuser&uid=" + userId + "&emailoptions=free");

Suggest reading up on MDNs JS learning tutorials. This is basic JS. I'm sorry, but I'm not here to teach you how to write basic JS. That's just far outside the scope of our support where all we provide is basic examples. We do not provide custom coding assistance.

developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 3 months ago - 2 years 3 months ago #327999 by galanopd
Replied by galanopd on topic [SOLVED] Email form
Thank you for providing an answer to this.

I'm sorry, but I'm not here to teach you how to write basic JS. That's just far outside the scope of our support where all we provide is basic examples. We do not provide custom coding assistance.


That's totally understandable. At the same time please understand that not all of us are expert developers and our profession might be something else but we do make efforts to learn and develop some things properly. The more help we get, the more we understand and enjoy working with CB and Joomlapolis team. Every time I realize that something is custom coding I try to solve without asking further questions in this forum (e.g. .siblings).

I always respect other's work and I demand the same. Maybe you are too busy to answer basic and "silly" questions like basic JS and in such cases I suggest you provide a link (as you did) in an effort to help those with little programming knowledge rather than typing what is quoted above as it could offend someone which I am sure in this case was not your intention, am I correct?

Moreover, in many forums users participate a lot helping each other unlike this one. I respect how things work in Joomlapolis (the culture), it is just that in this case the way things are structured, help comes mainly from you.

Thank you once again for your help,

Sincerely,

Galanopd

P.S. Even with
$('.cbEmailUserSubmit').click(function(){ 

    var userId = $(this).closest( '.cbUserListRow' ).data( 'id' );
    window.open("index.php?option=com_comprofiler&view=emailuser&uid=" + userId + "&emailoptions=free");
});

I still get "You are not allowed to send an email to yourself!"

Please Log in to join the conversation.

2 years 2 months ago #328004 by krileon
Replied by krileon on topic [SOLVED] Email form

I always respect other's work and I demand the same. Maybe you are too busy to answer basic and "silly" questions like basic JS and in such cases I suggest you provide a link (as you did) in an effort to help those with little programming knowledge rather than typing what is quoted above as it could offend someone which I am sure in this case was not your intention, am I correct?

Of course I've no intentions of offending anyone. Maybe we'll figure out something to have additional costs for more advanced support like coding assistance at some point.

Moreover, in many forums users participate a lot helping each other unlike this one. I respect how things work in Joomlapolis (the culture), it is just that in this case the way things are structured, help comes mainly from you.

We don't get a lot of user on user participation here. We've discussed incentive programs like points system for discounted purchases to try and improve this, but nothing concrete yet. I suppose one of the issues being only subscribers can post here so that's going to be a limiting factor as well. Maybe at some point we'll allow non-subscribers to reply to active subscriber topics.

P.S. Even with

I don't know where your HTML is to even know if the jQuery is correct. You'd need to check if userId is correct. You can log it to your browser console with console.log( userId ); and press F12 to open the console to see if it's correct. The below seams to work ok.

Custom HTML Field:
<div class="cbClicksInside cbEmailUserSubmit">Click Me !</div>

Note cbClicksInside is only needed if you need click behavior on a non-clickable element. For example if it's a <a or <button element they're already click ready, but if it's a div like the above you'll need cbClicksInside.

jQuery
$( '.cbEmailUserSubmit' ).on( 'click', function(){ 
	const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
	
	alert( 'User Clicked: ' + userId );
});

Should show an alert of the user id clicked. Tested on list and grid usages. So should work fine for redirects and popups too. For example the below seams to work fine.

$( '.cbEmailUserSubmit' ).on( 'click', function(){ 
	const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
	
	window.open( 'index.php?option=com_comprofiler&view=emailuser&uid=' + userId + '&emailoptions=free' );
});


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #328010 by galanopd
Replied by galanopd on topic [SOLVED] Email form
Thank you for answering all comments. The Joomlapolis professionalism has been confirmed for one more time.
The least I can do to support mutual understanding and good cooperation is to proceed in small donations from time to time (hadn't thought of that before) until you have a "...more advanced support like coding assistance at some point".

Concerning JQuery, the popup result showed "User Clicked: undefined".
Here follow the codes

HTML element form in UserList
<div class="row">
<div class="col-md-6 col-sm-6">
<div class="form-group"><select name="emailoptions" class="form-control"><option label="Please select" selected="selected" value="" class="noemail">Please select</option><optgroup label="Response 1" style="font-weight: bolder;"><option label="10" value="10" class="1"></option><option label="6" value="6" class="1"></option><option label="3" value="3" class="1"></option></optgroup><optgroup label="Response 2" style="font-weight: bolder;"><option label="24" value="24" class="1 2"></option><option label="12" value="12" class="1 2"></option><option label="6" value="6" class="1 2"></option><option label="2" value="2" class="1 2"></option></optgroup></select></div>
<div class="modules">
<div data-id="10">{loadmoduleid 240}</div>
<div data-id="button"><input name="submit" type="submit" value="Email [username]" id="submit-button" class="btn btn-primary cbEmailUserSubmit" /></div>
<div data-id="6">{loadmoduleid 234}</div>
<div data-id="3">{loadmoduleid 235}</div>
<div data-id="24">{loadmoduleid 236}</div>
<div data-id="12">{loadmoduleid 237}</div>
<div data-id="6">{loadmoduleid 238}</div>
<div data-id="2">{loadmoduleid 239}</div>
</div>
</div>
</div>

JQuery onBeforeDisplayUserList
const selectElement = document.querySelectorAll('select');

selectElement.forEach(select => {

	const modules = select.parentNode.nextElementSibling;

	select.addEventListener('change', function () {
		const indexSelected = this.selectedIndex;
		const indexValue = this.value;

		[].slice.call(modules.children).forEach((child, index) => {
			child.style.display = child.dataset.id === indexValue ? 'block' : 'none';

			if (indexSelected === 1 && (index === 0 || index === 1)) {
				child.style.display = 'block';
			}
		});
	});
});

$( '.cbEmailUserSubmit' ).on( 'click', function(){ 
	const userId = $( this ).closest( '.cbUserListRow' ).data( 'id' );
	
	alert( 'User Clicked: ' + userId );
});

Hope that you will be able to understand where is the problem. Please remember that the viewing person is either a page visitor (not registered) or a registered user.

Thank you

Please Log in to join the conversation.

2 years 2 months ago #328011 by krileon
Replied by krileon on topic [SOLVED] Email form

HTML element form in UserList

Where is this exactly? Is it inside a field on your userlist and showing per user? The jQuery provided is expecting the click to happen on an element in a users userlist row. Might be easier to just PM me a URL to the list if it's public access so I can review the structure exactly.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #328013 by galanopd
Replied by galanopd on topic [SOLVED] Email form

Where is this exactly? Is it inside a field on your userlist and showing per user? The jQuery provided is expecting the click to happen on an element in a users userlist row. Might be easier to just PM me a URL to the list if it's public access so I can review the structure exactly.


It is an HTML Code field that I have added in the UserList and it's shown per user. The click Submit button works fine and opens a new tab that leads to the CB Email form.
I have it on a local server but I will upload it later on tonight and will PM you credentials to access it.

Thank you

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.227 seconds

Facebook Twitter LinkedIn