Editable field in group created by mergeTBObjects

Workarounds and usability notes.

Editable field in group created by mergeTBObjects

Postby John Robin Dove » Tue Mar 24, 2015 3:13 pm

Hi Clifton,

I have made another 'dummy window' using a transparent field as the parent object + a group including a draggable object, an alpha shadow etc. All fine but this time I want it to perform like a Toolbook ask rather than a Toolbook request. I seem to have a problem. The text field for the user input becomes read only even though I have chosen Allow users to enter or modify text in this field if it is enabled. I assume that this might be caused by the mergeTBObjects function so I have tried making the parent field editable but then the merged objects group remains invisible. Could you help please?
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Editable field in group created by mergeTBObjects

Postby Clifton » Tue Mar 24, 2015 9:34 pm

After experimenting with this a little, it seems that the input field seems to work fine until the entire merged object is made draggable. Input field do not play well when merging since the function does not currently allow for the fact that an editable field is wrapped in a form tag. This of itself it not the problem, but it creates a DOM issue. The real problem is that the input field doesn't play well when the whole thing has to be dragged around.

Why not put your user form on a new page in the same book and the load it into a draggable field using pgGotoURL(). That should preserve the formatting. I haven't tried it, but it would be worth a try.

Also, when all else fails, there is always subModal() which will just work in this case.

Let use know how your experiments develop.
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Editable field in group created by mergeTBObjects

Postby John Robin Dove » Wed Mar 25, 2015 12:35 pm

Hi Clifton,

Thanks for your help. Overnight I had thought about a similar solution which I have now achieved. Instead of making another Toolbook DHTML I just use pgGoToURL to display this html in a suitable field.

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  <style type="text/css">
textarea {
 width: 380px;
 height: 27px;
 font-size: 1.2em;
 font-family: sans-serif, Arial, Helvetica;
 border: 1px solid black;
 resize: none;
}
</style>
  </head>
 
  <body>
   
  <textarea rows="1" cols="80" id="nameBox"></textarea>
 
  <script>

  function sendName(){
  var obj = document.getElementById("nameBox");
  var result = obj.value;
  top.tbfunction_pgTBObjSet("newName","text", result);
  }
 
  function setName(newName){
  var obj = document.getElementById("nameBox");
  obj.value = newName;
  obj.select();
  }
 
  function test(){
  var obj = document.getElementById("nameBox");
  alert(obj.value);
  }
 
  </script>

  </body>
</html>


It works well so I'm sure a TB DHTML would also do the job.

One other thing: perhaps you could add a note in the context help to warn that the Toolbook field used with psGoToURL MUST be activated ie non-editable. I've just spent a couple of hours trying to figure out what was wrong. Everything went to plan but remained invisible!
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: Editable field in group created by mergeTBObjects

Postby Clifton » Wed Mar 25, 2015 1:56 pm

A non-editable field becomes a <textarea> tag in DHTML. As such you cannot insert any HTML into it as this is a huge security violation for all browsers. Depending on the editable field "type" it may also be exported an an <input type="text"> tag. Either way, only simple text is permitted in HTML objects of these varieties.

Thanks for posting your solution!
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Re: Editable field in group created by mergeTBObjects

Postby John Robin Dove » Thu Mar 26, 2015 4:59 am

Yes, that sounds logical. There are a number of other questions I need to ask you about security but I guess they can wait until my project is a bit more advanced. I still have a long way to go.

P.S. In my case, using the field in a merged objects group, not even a textarea was displayed just a blank white rectangle.
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron