ui tab select using variable - user-interface

I am having problems when trying to change a tab
The code below is working
$('#tabs').tabs('select', 1);
WORKING FINE
The code below
var nextTab=$('#nextTab').val();
$('#tabs').tabs('select', nextTab);
IS NOT WORKING
The nextTab variable is a valid tab index
What am I missing?

Are you sure nextTab holds a valid tab index? If yes, don't know if this makes a difference, but try converting it to a Number:
var nextTab = Number($('#nextTab').val());

Related

adding row manualy into DataGrid using VB6

i want to display the data into DataGrid manually in VB6, source of data is not from database or other source. I have created the column, like this:
For i = 2 To 4
DataGrid1.Columns.Add i
Next i
DataGrid1.Columns(0).Caption = "No"
DataGrid1.Columns(1).Caption = "Subdataset"
DataGrid1.Columns(2).Caption = "Dimension"
DataGrid1.Columns(3).Caption = "Check"
DataGrid1.Columns(3).Caption = "Detail"
but i can't add row and add value into it, i have tried like this:
Me.DataGrid1.AllowUserToAddRows = True
DataGrid1.Row = DataGrid1.Row + 1
then i got error
Please tell me if anybody can help me, thank you
Not only is DataGrid designed to be a bound control, it doesn't support unbound use. Says so right in the doc. So, the short answer is that you can't do what you are trying to do, because it's designed to display values from a database.
Instead, you'll want to use the MSFlexGrid control (Not the MSHFlexGrid control, although some of the doc confuses them), which you can read about here. Suppose you play around with that (the AddItem method is the fundamental piece you need to work with) and post back with specifics if you have problems.
Once you have added the table (DataGrid) right click select edit then you can insert columns:

wysihtml5 - setting a value won't work, because 'sandbox iframe isn't loaded yet'

I'm just working on a little webservice. Therefore I am using an AJAX call and append my data to a table on my website. Here I can read and update already existing entries or write new entries. Everything works fine.
I want to have the possibility to update already existing with the wysihtml5 editor. I already integrated this editor on my website and I can use it on new entries. That works, too.
But now there's the problem with existing data. When it comes to the form to update data, I want the existing data being displayed as the value. Everything works fine on all inputs, just the wysihtml5 don't work.
I already know that there's an iframe and that's why I can't set the value of the textarea. I searched for a solution and found the following code (last line):
var editor = new wysihtml5.Editor("textareaid", { // id of textarea element
toolbar: "wysihtml5-toolbar", // id of toolbar element
parserRules: wysihtml5ParserRules, // defined in parser rules set
});
editor.setValue('Here's the content', true);
Usually this should work, but no content appears and the console just tells me:
Error: wysihtml5.Sandbox: Sandbox iframe isn't loaded yet
I tried it with a timeout-function but nothing works. Searching on the internet it also seems that there is noone else with that problem. I hope you can help me out, would be great!
Is there a way to set the value?
This code work for me
$("#product_details").data("wysihtml5").editor.getValue();// to get the value
$("#product_details").data("wysihtml5").editor.setValue('new content')// to set the value
I got the solutions, below code worked for me
$('#id ~ iframe').contents().find('.wysihtml5-editor').html(my_html);
This work for me
$('.wysihtml5-sandbox').contents().find('.wysihtml5-editor').html(my_html);
the ".wysihtml5-sandbox" is a class name of iframe, create by wysihtml5 by default.
I finally got it working by myself. I just change the second parameter of setValue to false. I don't know why, but it works then.
this code worked for me :
var wysihtml5Editor = $('#text_editor').data("wysihtml5").editor;
wysihtml5Editor.setValue("<p>foobar</p>", true);
console.log(wysihtml5Editor.getValue());

Convert auto page numbers special character to actual value in InDesign document

I need to go through an InDesign document a convert all the auto page number special characters to their actual value.
So on each page, find a auto page number symbol and replace it with the value it evaluates to.
I haven't been able to find a script that does that - nor am I an inDesign scripting expert.
Has anyone got a solution for this?
Ok, I think I've worked it out.
main();
function main(){
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
app.findGrepPreferences.findWhat="~N";
var FindGrep=app.activeDocument.findGrep();
for(i=0; i<FindGrep.length; i++)
{
var item = FindGrep[i];
var page = item.parentTextFrames[0].parentPage;
item.contents = page.name;
}
alert("done");
}
Struggled to find any valuable documentation from Adobe.
This really helped: http://jongware.mit.edu/idcs5/
As well as this SO question: Get current page number in InDesign CS5 from Javascript
Edit: If your page numbering is in a master, you will need to "override all page master items" (check the pages palette)
Edit 2: This worked on inDesign 5.5 (not sure about 6)
Edit 3: Works also on InDesign CC

How to open and handle richtext editor in javascript in sitecore 6.5?

I've been working on a custom field, which contains a list.
I have to be able to edit the selected item on the list in a richtext editor. (this is the only missing part).
I've read the topic on opening from c# code Opening Rich Text Editor in custom field of Sitecore Content Editor .
This works nice for the "add" button, since i have to open the RTE empty(with default text...), but not for the Edit button.
My aproaches are:
Somehow in the Edit button's message field list:edit(id=$Target) pass the selected index (like list:edit(id=$Target,index=$SelectedIndex), but i don't know how to populate $SelectedIndex
Somehow in the overridden HandleMessage method get the list's selected index. I'm able to get the selected value Sitecore.Context.ClientPage.ClientRequest.Form[ID of list], but thats alone not much of a help, since i won't be able to decide which one to edit if two listitem equals.
Do the richtext editor opening and handling fully in javascript. As i saw at some script in content editor, i tried to do that, but i can't understand it clearly:
richtext editor url:
var page = "/sitecore/shell/Controls/Rich Text Editor/EditorPage.aspx";
some params :
var params = "?da=core&id&ed=" + id + "&vs=1&la=en&fld=" + id + "&so&di=0&hdl=H14074466&us=sitecore%5cadmin&mo";
and the part where i'm not sure:
var result = scForm.browser.showModalDialog(page + params, new Array(window), "dialogHeight:650px; dialogWidth:900px;");
This way the RTE opens as expected (i guess i could get the selected index from javascript and pass it as a parameter later). However when i click ok, i get exception from EditorPage.js saveRichText function: Cannot read property 'ownerDocument' of null. Am i missing some parameter?
Either of the three aproaches is fine for me(also i'm open for new better ones) as soon as i'm able to do it.
Thanks in advance!
Tamas
I was able to enter some javascript into the message:
list:Edit(id=$Target,index='+document.getElementById(ID of the select using $Target ).selectedIndex+')
this way i got the index in HandleMessage.
I'm waiting for better solutions now.

How to Pass Multiple Values into TextField using Watin

I'm using WatiN for web application testing. There is a field called enter choices where i need to add 3 values one after the another by pressing enter key i.e., add 1st value then press enter key and Add 2nd value press enter key, so please suggest me how to make this work using WatiN.
thankingyou
Here is another answer for the problem. When i passed enter key there it was giving a "Keyword delimiter is missing" error so instead i passe "\r\n" it worked fine.
WatiN.Core.IE ie = new WatiN.Core.IE():
TextField txtChoices = ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_TxtChoices"));
txtChoices.TypeText("NotBad");
System.Windows.Forms.SendKeys.SendWait("\r\n");
txtChoices.AppendText("VeryGood");
System.Windows.Forms.SendKeys.SendWait("\r\n");
txtChoices.AppendText("Awesome");
The above method which jose has suggested, i made little changes to the code it worked for me. Jus replace TypeText by AppendText for entering the second value.
WatiN.Core.IE ie = new WatiN.Core.IE();
TextField txtChoices =
ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_TxtChoices"));
txtChoices.TypeText("NotBad");
System.Windows.Forms.SendKeys.SendWait("{ENTER}");
txtChoices.AppendText("VeryGood");

Resources