Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Can I Limit Text That Can Be Entered For Link Text (Read 1600 times)
alukes
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Jul 1st, 2011
Can I Limit Text That Can Be Entered For Link Text
Dec 22nd, 2017 at 3:51am
Print Post  
I want to limit what a user can enter after double clicking a link to Y or N.

Is that possible?

If not, can I display suggestions in the text box when the text box is displayed?

or can I check the users input and display an error message?

Or any other idea you might have.

Thanks
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Can I Limit Text That Can Be Entered For Link Text
Reply #1 - Dec 22nd, 2017 at 9:54am
Print Post  
You could handle enterInplaceEditMode event to get a reference to the text box, and attach some validation / suggestion library to it. Alternatively handle createEditControl event and you could set a checkbox or a select element as editor -

Code
Select All
diagram.addEventListener(Events.createEditControl, onCreateEditor);

function onCreateEditor(sender, args)
{
	var select = document.createElement("select");

	var yes = document.createElement('option');
	yes.value = "Yes";
	yes.innerHTML = "Yes";
	select.appendChild(yes);
	var no = document.createElement('option');
	no.value = "No";
	no.innerHTML = "No";
	select.appendChild(no);

	args.setControl(select);

	var bounds = args.getBounds();
	select.style.position = 'absolute';
	select.style.left = bounds.x + 'px';
	select.style.top = bounds.y + 'px';
	select.style.width = bounds.width + 'px';
	select.style.height = bounds.height + 'px';
	select.style.zIndex = 2;

	document.body.appendChild(select);
} 



Regards,
Slavcho
« Last Edit: Dec 22nd, 2017 at 4:30pm by Slavcho »  
Back to top
 
IP Logged
 
alukes
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 61
Joined: Jul 1st, 2011
Re: Can I Limit Text That Can Be Entered For Link Text
Reply #2 - Dec 23rd, 2017 at 3:23am
Print Post  
Copied and pasted. Worked perfectly.

Thanks for your usual excellent support.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint