Hi all!, I'm creating a app with PHP and MySQL, the system administrator is capable of creating profiles, on each profile we create, we add a custom access menu (a javascript tree view menu), theres a <textarea> where the admin enters the tree array, example:
[ [''Main,0,['sub1',0,0],
['sub2',0,0] ], [''Manuals,0,0],
[''whatever,0,0],
[''Options,0,0] ]
I want to create a "preview" button that would open a popup with the preview of the tree.... the script of the pop-up to create the tree preview is: *if i do this: - var arr =[['SAP Introduction',0]];
-
var arbol=new tree (arr, TREE_TPL);
-
It Works! *if i catch the contents of the <textarea> like this:
alert(opener.th edata); //made this to test the input and displays [['SAP Introduction',0]] - var arr =opener.thedata;
-
var arbol=new tree (arr, TREE_TPL);
-
Did not work
How could i conver the string recieved into an array? it worked using a php variable like this:
[HTML]<script language="JavaS cript">
var test =[<?php echo $database->getTree($sessi on->username);?>];
var arbol=new tree (test, TREE_TPL);
</script>
[/HTML]
Hope you guys can help me!!
Cheers!
gsosa
7 2004
The user enter the array on a <textarea> on the following format:
[ [''Main,0,['sub1',0,0],
['sub2',0,0] ], [''Manuals,0,0],
[''whatever,0,0],
[''Options,0,0] ]
Theres a "preview" link that will open a pop-up that uses the users array (entered on the textarea) to create the tree with the following javascript code:
var arbol=new tree (info_from_the_ textarea, TREE_TPL);
but this is obviously a string and its not being detected as an array, what can i do? i tried adding square brackets [] on each side of the variable (that worked when pulling the tree from MySQL and PHP).
Please help me hehe.
Thanx in advance
acoder 16,027
Recognized Expert Moderator MVP
There probably is a better solution, but eval should work.
acoder 16,027
Recognized Expert Moderator MVP
Just noticed the double-posted thread on the same topic which I've merged
There probably is a better solution, but eval should work.
I just tried eval() and didnt work I tried this - var input = new Array([string_with_the_array_structure]);
- var input = new Array(eval(string_with_the_array_structure));
any other suggestions??
gits 5,390
Recognized Expert Moderator Expert
hi ...
just try to use eval and remove the new Array instantiation ...
kind regards
Great! now it worked!! - var arbol=new tree (eval(opener.thedata), TREE_TPL);
that was the answer =)
Thanx a lot guys!
acoder 16,027
Recognized Expert Moderator MVP
You're welcome. Post again if you have any more questions which we'll make an attempt at answering.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Hal Vaughan |
last post by:
If I have a byte and I convert it to string (String sData = new
String(byte bData), then convert it back (byte bData = sData.getBytes()),
will all data be intact, or do Strings have problems with bytes that are
not printable characters? I've tested this and it seems to work fine, but
I want to make sure there isn't some condition or situation I'm not aware
of that could cause problems.
I'm doing this because it's easier to do some of my...
|
by: _BNC |
last post by:
I've converted " byte" to "byte *" at times, using 'unsafe' and
fixed { .... }, but the reverse does not seem to work.
In this case, a C++ DLL returns a byte * and a length. What is the best
way to convert these to straight C#-compatible straight " byte" arrays?
PS: The C++ DLL is actually managed and I have access to the source.
Perhaps there is a simpler syntax for doing the conversion there, and
returning a C# compatible array...
|
by: Jofio |
last post by:
I have a .h (header file) linked using #include<...>. I also have a .cp
file which i don't know how to include in the header of my "main" file.
I have the following c++ file.
The file names are: 1) dArray.h
2) dArray.cp
3) dArrayTest.cpp
dArray.h file declares and defines a class called DynamicArray.
dArray.cp defines the functions declared as member functions in
DynamicArray class in dArray.h. This dArray.h is includded in the
|
by: nomad |
last post by:
Hi everyone;
My Class has ended and I was not able to solve this problem in time, and I would still like to solve it.
I got these error code.
Exception in thread "main" java.lang.NullPointerException
at ticketSales.TicketSales.makeEvent(TicketSales.java:185)
at ticketSales.TicketInput.main(TicketInput.java:56)
Anyway I have several Class
This one is called TransAction
|
by: stainless |
last post by:
I know this is probably simple but I cannot find a method of
converting a date string into a format that matches the DatePicker
format in C#
eg string "20080131" converted to "31 January 2008"
I tried datetime.parseexact but could not find the definition for the
appropriate format string.
This would be a very useful tool fo me. Any ideas,please?
| |
by: Light |
last post by:
Hi
I m getting this error while i m trying to run my program and i don't understand why that happens.
import java.util.*;
public class Exercise6 {
|
by: gator6688 |
last post by:
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class PayrollSystemTest {
public static void main( String args )
{
String workerType;
String first;
String last;
|
by: lilyumestar |
last post by:
This project is due by Tuesday and I haven't even gotten half of it done. Can anyone please help me with this Exception error? I've been trying to figure it out for several hours
Error Message
"Main" Java.lang NullPointerException
at Project1.sortingByZipCode<Project1.java:80>
at Project1.main<Project1.java:31>
Here is the Source Code
|
by: ohadr |
last post by:
hi,
i get Exception in thread "main" java.lang.NullPointerException
when i run my application.
the exact error is:
"Exception in thread "main" java.lang.NullPointerException
at sortmergejoin.MergeJoin.Field(MergeJoin.java:204)
at sortmergejoin.MergeJoin.SMJoin(MergeJoin.java:84)
at sortmergejoin.MergeJoin.<init>(MergeJoin.java:34)
at sortmergejoin.Main.main(Main.java:24)
Java Result: 1"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |