Jump to content
UBot Underground

How do I Update UI Html Panel onclick?


Recommended Posts

I'm trying to find a way to edit and save data from a file using the UI HTML Panel.

 

By default the html panel just has your standard set of text input boxes, each one assigned a variable.  You click the button and it saves the data you put in the fields, to a csv file.  Very simple.

 

Now what I'm trying to do, is work out a way to EDIT data in the csv file.  Since I don't use the browser at all (visibility off), I need a way to populate the UI Html Panel.

 

When I display the results of the table where the info is saved, basically it runs a loop, displays all the entries in the table via the HTML panel and displays an 'edit' button next to each one. (I'm good up to here)

 

Now the hard part, is when the edit button is clicked, I need it to somehow populate UI HTML fields with all the default values from whatever row in the csv file is being edited, so the user could update the information.

 

Do I need to use javascript of some sort?  If so could somebody please create an example for me to check out?  If anybody has a solution for this I'd be hugely grateful.

 

I know how to display NEW html in the ui html panel when the button is clicked, I've been doing it forever.  However when I load new HTML, such as input fields, they are not editable for some reason.  This is why I'm hoping there is a way to populate an existing ui html text field rather than creating a new one, hopefully that works.

Link to post
Share on other sites

There's this...

 

if($not($exists(<name="Sports">))) {
    then {
        load html("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>Untitled</title>
<script language=\"Javascript\">
<!--
function PopulateTeams(o) \{
var Teams = document.frmMain.Teams;
Teams.options.length = 0;
if (o == \"1\") \{
Teams.options[Teams.options.length] = new Option(\"Oakland Athletics\", \"1\");
Teams.options[Teams.options.length] = new Option(\'San Francisco Giants\', \'2\');
\}
if (o == \"2\") \{
Teams.options[Teams.options.length] = new Option(\'Oakland Raiders\', \'3\');
Teams.options[Teams.options.length] = new Option(\'San Francisco 49ers\', \'4\');
\}
if (o == \"3\") \{
Teams.options[Teams.options.length] = new Option(\'Golden State Warriors\', \'5\');
Teams.options[Teams.options.length] = new Option(\'Minnesota Timberwolves\', \'6\');
\}
\}
//-->
</script>
<style type=\"text/css\">
body \{
background: #FBFBFB;
\}

</style>
</head>
<body>
Make selections and run again:
<form name=\"frmMain\">
<select name=\"Sports\" variable=\"#sportssel\" onchange=\"PopulateTeams(document.frmMain.Sports.options[document.frmMain.Sports.selectedIndex].value);\" size=\"4\">
<option>Choose a Sport</option>
<option value=\"1\">Baseball</option>
<option value=\"2\">Football</option>
<option value=\"3\">Basketball</option>
</select>

<select name=\"Teams\" variable=\"#sportsteam\" onchange=null; size=\"3\">
<option> </option>
</select>
</form>
</body>
</html>")
        stop script
    }
    else {
    }
}
set(#sportssel$eval("document.frmMain.Sports.options[document.frmMain.Sports.selectedIndex].value"), "Global")
set(#sportsteam$eval("document.frmMain.Teams.options[document.frmMain.Teams.selectedIndex].value"), "Global")

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...