Submiting a form with variables packed into an associative array

I have a complex form created in flash that submits to a
shopping cart. I was having trouble getting the variables in the
right format for the shopping cart to accept.
So I created a bridging script in php that fills in the
hidden fields of a form then uses javascript to submit it to the
cart. This works but I would like to submit the variables directly
to the cart and eliminate the need for a bridge.
At the moment I am simply using
getURL("bridge.php", "_self", "POST");
to POST the variables to the bridge.
The bridge code is
<?php
$id[txt_1] = "$colortext";
$id[txt_2] = "$xheight";
$id[txt_3] = "$xwidth";
$id[txt_4] = "$nopanels";
$id[txt_5] = "$shutterstyle";
$id[txt_6] = "$squarearea";
$id[txt_7] = "$finish";
$id[txt_8] = "$bifoldoption";
$id[txt_9] = "$slidingoption";
$id[txt_10] = "$hingedoption";
$id[txt_11] = "$totalprice";
$id[txt_12] = "$colorcode";
$products_id = "28";
?>
<form
action="product_info.php?products_id=28&action=add_product"
method="post" name="MyForm" target="_self">
<input type="submit" name="Submit" value="Submit">
<input name="id[txt_1]" type="hidden" value="<?php
print($id[txt_1]); ?>">
<input name="id[txt_2]" type="hidden" value="<?php
print($id[txt_2]); ?>">
<input name="id[txt_3]" type="hidden" value="<?php
print($id[txt_3]); ?>">
<input name="id[txt_4]" type="hidden" value="<?php
print($id[txt_4]); ?>">
<input name="id[txt_5]" type="hidden" value="<?php
print($id[txt_5]); ?>">
<input name="id[txt_7]" type="hidden" value="<?php
print($id[txt_7]); ?>">
<input name="id[txt_6]" type="hidden" value="<?php
print($id[txt_6]); ?>">
<input name="id[txt_8]" type="hidden" value="<?php
print($id[txt_8]); ?>">
<input name="id[txt_9]" type="hidden" value="<?php
print($id[txt_9]); ?>">
<input name="id[txt_10]" type="hidden" value="<?php
print($id[txt_10]); ?>">
<input name="id[txt_11]" type="hidden" value="<?php
print($id[txt_11]); ?>">
<input name="id[txt_12]" type="hidden" value="<?php
print($id[txt_12]); ?>">
<input name="products_id" type="hidden" value="28">
</form>
<script type="text/javascript"
language="JavaScript"><!--
document.MyForm.submit();
//--></script>
I am trying to create in flash 8 the equivalent of the above
form using the function below.
function submitvars() {
var id: Array = new Array();
id.txt_1 = colortext;
id.txt_2 = xheight;
id.txt_3 = xwidth;
id.txt_4 = nopanels;
id.txt_5 = shutterstyle;
id.txt_6 = squarearea;
id.txt_7 = finish;
id.txt_8 = bifoldoption;
id.txt_9 = slidingoption;
id.txt_10 = hingedoption;
id.txt_11 = totalprice;
id.txt_12 = colorcode;
var myvar:LoadVars = new LoadVars();
myvar.id = id;
myvar.products_id = '28';
myvar.send("product_info.php?products_id=28&action=add_product",
"_self", "POST");
So far the variable products_id = ‘28’ transfers
over to the cart fine but not the variables in the ‘id’
array

You're welcome.
I've never used register globals, couldn't figure that out,
thanks for explaining.
The other way to do it if you want to send an array of simple
data (usually all of one data type like string or number) is to use
array.join("delimiter_sequence"); in flash. You can then assign it
to a single property of your loadvars (e.g. 'id') and use explode
in php with the same delimiter to recreate an array. This does not
give you an associative array though, just a regular numeric
indexed one.
To send complex data like arrays and objects, you can use
other encoding techniques. You can even use json: json.org has a
json class(es) for flash and php 5 has json encoding/decoding
support for example.
Another way is to use amfphp and remoting, which does all the
work for you. And of course, you have XML support as well at both
ends, so you can always represent complex data in XML if you
prefer. You may want to investigate these or other methods on
future occasions.

Similar Messages

  • Submitting a form with an anchor tag

    How could I do this? I'm using a self submitting html form with JSP. I want an anchor tag to send some parameters to update the content of the page.

    Hi,
    You can use query string to pass the parameter values to the page.
    Ex:
    firstname and secondname are the two parameter values which you can pass it to the page.
    <ahref=http://website2.com/action?val1=' firstname' & val2='secondname'> Page2</a>
    if you click on the 'Page2' then those values are pass to the corresponding page
    Regards
    Reegan

  • Submiting HTML Forms with JavaFX Webview

    I've long been searching for a good web robot framework. And I also need a gui for my robot.
    So w/ the advent of JAVAFX Webengine it seemed my needs have been met finally. Specially because on the webview tutorial here , Alla Redko says: "+It supports user interaction such as navigating links *and submitting HTML forms*+".
    But after looking at the api it doesn't seem that webengine supports submiting forms, only loading pages w/ the load() method. I guess I could populate the form fields and submit them w/ executeScript() but that's just sloppy.
    Is there a way to actually submit forms w/ webengine? Are there plans to implement this feature, analogous to the load() method?
    Thanks,
    JC

    Yea, as I mentioned in the first post, I could do all that w/ JS but it's just sloppy, since I'm using Java language, not JS.
    The finding certain fields part is easy w/ the Document model and xpath, it's the populating the fields and submiting the form along w/ its hidden input fields that is the missing part.
    Does anyone know if these things are planned for the future of Webview/Webengine?You can already do this in Java today using the existing APIs if you so wished.
    import javafx.application.Application;
    import javafx.beans.property.*;
    import javafx.beans.value.*;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.layout.*;
    import javafx.scene.web.*;
    import javafx.stage.Stage;
    import org.w3c.dom.*;
    import org.w3c.dom.html.*;
    public class WebViewFormPost extends Application {
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage stage) {
        final TextField fxUsername = new TextField();
        final TextField fxPassword = new PasswordField();
        final BooleanProperty loginAttempted = new SimpleBooleanProperty(false);
        final WebView webView = new WebView();
        final WebEngine engine = webView.getEngine();
        engine.documentProperty().addListener(new ChangeListener<Document>() {
          @Override public void changed(ObservableValue<? extends Document> ov, Document oldDoc, Document doc) {
            if (doc != null && !loginAttempted.get()) {
              if (doc.getElementsByTagName("form").getLength() > 0) {
                HTMLFormElement form = (HTMLFormElement) doc.getElementsByTagName("form").item(0);
                if ("/oam/server/sso/auth_cred_submit".equals(form.getAttribute("action"))) {
                  HTMLInputElement username = null;
                  HTMLInputElement password = null;
                  NodeList nodes = form.getElementsByTagName("input");
                  for (int i = 0; i < nodes.getLength(); i++) {
                    HTMLInputElement input = (HTMLInputElement) nodes.item(i);
                    switch (input.getName()) {
                      case "ssousername":
                        username = input;
                        break;
                      case "password":
                        password = input;
                        break;
                  if (username != null && password != null) {
                    loginAttempted.set(true);
                    username.setValue(fxUsername.getText());
                    password.setValue(fxPassword.getText());
                    form.submit();
                    System.out.println("Submitted login for user: " + username);
        engine.getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() {
          @Override public void changed(ObservableValue<? extends Throwable> ov, Throwable oldException, Throwable exception) {
            System.out.println("Load Exception: " + exception);
        GridPane inputGrid = new GridPane();
        inputGrid.setHgap(10);
        inputGrid.setVgap(10);
        inputGrid.addRow(0, new Label("Username: "), fxUsername);
        inputGrid.addRow(0, new Label("Password: "), fxPassword);
        Button fxLoginButton = new Button("Login to Oracle Forums");
        fxLoginButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent t) {
            if (notEmpty(fxPassword.getText()) && notEmpty(fxPassword.getText())) {
              loginAttempted.set(false);
              engine.load("https://forums.oracle.com/forums/login!withRedirect.jspa");
        final VBox layout = new VBox(10);
        layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
        layout.getChildren().addAll(
          new Label("Enter your Oracle Web Account credentials"),
          inputGrid,
          fxLoginButton,
          webView
        stage.setScene(new Scene(layout));
        stage.show();
      private boolean notEmpty(String s) {
        return s != null && !"".equals(s);
    }Personally, I think using JavaScript via engine.executeScript calls in combination with jquery might be a less messy solution (as I don't like writing against the raw dom apis), but I understand that there are valid reasons why you might prefer to use a Java only solution.
    https://gist.github.com/jewelsea/3077942 "Embeds jQuery in a document loaded into a WebView."

  • Submitting a form with customize subject line

    Hi
    I would like some help with Submitting a form via E-mail with a customize subject line. I want the subject like to be the First name of the person which they would have to enter in the form. Is this possible?
    Thanks

    Look at this previous thread:
    http://forums.adobe.com/message/5615207#5615207
    The script would look something like:
        //Place into a submit button     
         var cSubLine = this.getField("FirstName").value;       //Replace FirstName with the name of the field on your form
         this.mailForm({
         bUI: true,
         cTo: "[email protected]",
         cSubject: cSubLine,

  • Submitting a form with enter key causing strange problems

    I am having a very strange problem with a webapp I am currently developing. I am using JSF 1.2 along with Facelets and RichFaces. I have coded a workflow/wizard 4-step process, and on some pages I have 4 submit buttons that all call different actions on the page. The users thought it would be useful to have the enter key submit the form, so I followed some online resources to trap a keypress using javascript, looking for the enter keycode and calling document.getElementById("elementName").click(). This works fine most of the time. Sometimes, though, it seems as if an entire new session is being created, and odd behavior starts happening. For example, my page will only include 2 of the 4 facelets on the screen -or- I will get NullPointerExceptions for objects that I know have been created in the session bean I am currently using -or- I will get a duplicate form Id after trying to re-submit the page. Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"? I'm really at my wit's end here (plus it's nearly 3 AM, that never helps things). All of the buttons being clicked are standard h:commandButtons. There is some setTimeout logic included to disable the buttons on the page to prevent double clicks (I cannot disable them onsubmit because disabled buttons don't pass the right values, perhaps that's causing it, but if so, clicking the buttons with the mouse would cause that issue too, right?)
    I am not posting the code (yet), but if anyone wants to take a look see and see if I am doing something really abhorrently wrong, I'm more than willing to, I'm just curious if anyone has had problems regarding javascript submission of forms via the click() method. Clicking the button does not exhibit this type of behavior. Just as a side note: I am doing different things with the enter key depending if a modal window is open (the enter key closes the modal if it's up, and if not, it submits the form via a button click).
    Any help is much appreciated, if anyone has any inkling about where I should start looking for answers it would be really helpful.
    Thank you.

    edfrost wrote:
    Could the javascript click simulation not be submitting all of the form elements or is the enter key also acting like its default action (the form submission) in addition to the "click"?My guess is the second of these. You need to suppress the event handling after programmatically clicking the button.

  • Wrong values submitted when submitting a form with javascript

    Hi guys, I know this aint a struts forum, but I did not know where else to go. So here goes..
    I have the following code in my jsp
    <logic:iterate id="ex" name="myForm" property="users">
    <html:multibox property="deleteUsers">
    <bean:write name="ex" property="userId"/>
    </html:multibox>
    </logic:iterate>
    I have about 10 users of which 5 have already been marked for deletion from another action. So basically, the above tag renders 10 rows with a checkbox in the beginning to select users to delete. Also 5 of them have been checked already, I mean when the form is loaded. So checkboxes 1, 4, 5, 8, 10 have already been checked. Now I have a link on which goes like this
    Select None. On this I call a javascript which does the following
    function uncheckAll() {
    for (i = 0; i < 10; i++) {
    document.myForm.deleteUsers.checked = false;
    This unchecks all my checkboxes.
    Now comes the problem. I am submitting the form using a javascript which is invoked on clicking on the submit link using document.myForm.submit(); The problem is the deleteUsers property in myForm still retains the old values. If the checkboxes are unchecked no values should be submitted for this and the deleteUsers array should be empty. Can anyone help me out on this.
    Thanks.

    Checkboxes only submit a value when they are "on"
    They submit nothing if they are not selected.
    The problem comes - do you interpret no checkbox values as "clear all values" or "leave the values alone"? Struts assumes the latter.
    Your form is probably being kept in session?
    Try implementing the reset() method of your action form and set its property to be equivalent to no checkboxes selected.

  • Creating a form with variable table name(s)

    Hi,
    I am building a form that will allow user(s) switch to other user
    (s) dynamically. I have been able able to do this by creating a
    non-database table and use record group to read from the base
    table of each user.(All the tables in question have the same
    structure).
    Record group is a read only, and I want to be able to do data
    maninpulation with this form.
    The questions are
    (1) It possible to do data manipulation with record group and if
    it is, how?
    (2) Is it possible to build a form with a variable table name?
    if possible, how?
    Somebody pls help.
    Thanks,
    Olutunde.
    null

    Olutunde Babarinsa (guest) wrote:
    : Hi,
    : I am building a form that will allow user(s) switch to other
    user
    : (s) dynamically. I have been able able to do this by creating a
    : non-database table and use record group to read from the base
    : table of each user.(All the tables in question have the same
    : structure).
    : Record group is a read only, and I want to be able to do data
    : maninpulation with this form.
    : The questions are
    : (1) It possible to do data manipulation with record group and
    if
    : it is, how?
    : (2) Is it possible to build a form with a variable table name?
    : if possible, how?
    : Somebody pls help.
    : Thanks,
    : Olutunde.
    Hi,
    you can create and manipulate record groups at runtime(see Forms
    Reference 'Create_Group' and 'Add_Group_Row') don't use
    Create_Group_from_Query. For your purpose it's better to build a
    cursor loop on your Query and add your datas after
    manipulating with 'Add_Group_Row' to your Record Group.
    It's possible to SET_BLOCK_PROPERTY(QUERY_DATA_SOURCE_NAME) but
    it's not possible to change the item property 'Column Name'.
    Therefor I would suggest to build a non database block and
    populate these block by a programm unit, which works with a
    pl/sql cursor loop and the 'create record' to populate these
    block.
    null

  • Parsing XMLType into an associative array

    I'm try to build a procedure that can take an XMLType as a parameter. What I would like to do be able to extract both the node names and the string values from each tag of the XML and put them into basically a key --> value associative array.
    Ex:
    <envelope>
    <node1>value1</node1>
    <node2>value2</node2>
    </envelope>
    Would be put into an array structured like: array['node1'] = 'value1', array['node2'] = 'value2', etc.
    I'm not entirely sure how I go about looping through the XMLType and extracting each node name and its value. I'm not worried about repeating tag names.. I know that will not be an issue in any of the XMLTypes that I'm using.
    Would anyone be able to offer any suggestions? If not how to go about doing exactly that, then at least some insight as to how I can loop through and extract nodes and/or values without specifying the specific XPaths?
    Thanks in advance!

    Hi Roger,
    This is a good description of your process. Just add your Oracle DB Version somewhere. Want you want is a method to map your XML to a relationship design (some special variant of object-relational-modelling).
    I still see two choices:
    The programmatic approach (as you described):
    Have multiple procedures where you input an XML. Each procedure is reflecting a different part of the transformation process. So it depends from the Message which procedure you will call.
    Example
    SQL*Plus: Release 9.2.0.2.0 - Production on Thu Aug 14 17:53:25 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> create table testtab (username varchar2(100));
    Table created.
    /* the following insert part should be in some packaged procedure, */
    /* this just don't work on my 9i version, but should in 10g  */
    SQL> insert into testtab (username)
      2  select substr(extractvalue(column_value,'*/text()'),1,100)
      3  from table(xmlsequence(extract( xmltype('<envelope>'||
      4               '<username>Roger</username>'||
      5               '<username>Sven</username>'||
      6               '</envelope>'),'envelope/username')));
    2 rows created.
    SQL> select * from testtab;
    USERNAME
    Roger
    Sven
    SQL> The declarative approach:
    Insert the XML into a SchemaBased Table. The XML Schema will provide the mapping to your relational tables automagically. Problem here is the writing, handling and evolving of the XML Schema (Sub schemas are allowed too).

  • Trouble submitting PDF form with Web Mail

    Hello,
    I have a fillable PDF form that I'm trying to submit. When I submit the form through an email client (Outlook, Mail, etc.) it works perfectly. When I try to submit using the Webmail option, I get this message: "An unknown error has occurred while uploading the attachment. If you are not sure how to proceed further, you can save your form and return it manually using your Internet mail service."
    I've checked the file thoroughly and everything looks correct. I'm perplexed as to why it submits just fine through an email client, but won't submit via Webmail. I've tried on a Mac and a PC and I've tried using a Yahoo account and a Gmail account with the same results. Any ideas?
    Thanks!
    Kate

    I'm using Acrobat XI Pro. I don't have Reader installed on my laptop. The form is for a client who sends it out to patients to fill out, so I need it work with both mail clients and web mail. Is there a way to do that? I don't think changing that preference in my Acrobat will solve the problem, as that will just effect my Acrobat. Is there a setting I can apply to the actual document? Thank you for your response!

  • Importing a text file with variable values into web reporting

    Hello,
    I'm looking for a possibility to import values from a text file into a variable selection in Web reporting.
    With BEx reporting in Excel this is possible, by clicking on the multiple selection button in the variable popup screen, and subsequently selecting the "Import from Text file" button.
    However, this function seems not to be available for web-reporting...
    It would be great if someone could help me out with this!
    Thanks & regards,
    Arvid

    Hi,
    we could resolve this issue, so i thought it may also be helpful for others:
    In our example we used a file with numbers for materials. This file is stored somewhere in a directory, to which SAP BI must have authorization to read.
    The file looks something like this:
    4711
    4712
    4713
    4714
    The file is named "import.txt" and lays in directory "/usr/sap/EC6/files/bi/"
    *&  Include           ZXRSRU01
    * global variables
    Data: intern_range LIKE LINE OF i_t_var_range,
          l_s_range    TYPE rsr_s_rangesid,
          line(100)    TYPE c,
          p_file(128)  TYPE c,
          length_rangelow  type i,
          tmp_rangelow     like l_s_range-low.
    * internal tables for selection-transfer from transaction
    * Data: BEGIN OF it_file occurs 0,
    *        it_p_file(128) TYPE c,
    *      END of it_file.
    IF i_step = 1.
    ** variables can be changed or set before pop-up appears
      CASE i_vnam.
    * take material from external file to selection-list
         WHEN 'ZSD_UPMA'.
    ** call of transaction, with which the path can be set
    *CALL TRANSACTION 'ZBW_VARIABLE' using it_file
    *MODE 'A'      " call should be visible, so that variable can be set
    *UPDATE 'S'.   " first transaction, then processing
    ** Der Pfad, der in dem Selektionsbild eingegeben wird, wird an die Variable übergeben
    ** Der Set-Parameter ist in Report ZSD_SELECT_VARIABLE
    *  get parameter id 'VAR' field p_file.
    p_file = '/usr/sap/EC6/files/bi/import.txt'.
    * further handling of variable in BI
          OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
          IF sy-subrc = 0.
            READ DATASET p_file INTO line.
            WHILE sy-subrc = 0.
              IF line(2) <> '//'.
                l_s_range-sign = 'I'.
                l_s_range-opt  = 'EQ'.
                l_s_range-low  = line.
    * fill with leading Zeros
    * in variable tmp_rangelow the value from l_s_range-low is taken
        tmp_rangelow    = l_s_range-low.
    * read the length
        length_rangelow = strlen( tmp_rangelow ).
    * in our case: material has 18 characters
        while length_rangelow lt 18.
          CONCATENATE '0' tmp_rangelow INTO tmp_rangelow.
          length_rangelow = length_rangelow + 1.
        endwhile.
    * initialize l_s_range-low
        clear l_s_range-low.
    * set with filled values
        l_s_range-low = tmp_rangelow.
    * transfer to structure
                APPEND l_s_range TO e_t_range.
              ENDIF.
              READ DATASET p_file INTO line.
            ENDWHILE.
          ENDIF.
          CLOSE DATASET p_file.
        ENDCASE.
    ELSEIF i_step = 2.
    ** in step 2 all variable values from pop-up input can be processed or
    ** User Exit variables can be derived
    * UserExit Ende.
    ENDIF.
    Hope i could help!
    Best regards,
    Tobias

  • Submiting multiple forms with one button

    I have a form that has a cfform within it. The cfform has a
    cfloop in it that includes an id and a dropdown list box that
    includes a new id. I want to transfer one id to another. I want the
    user to be able to click on one button that would update all the
    rows in the table with the new id.
    If there are 3 rows in the query, the user would select an
    entry in a dropdown for each row and upon clicking on the submit
    button all three rows would be updated with the id selected from
    the dropdown.
    Any suggestions?
    Thanks for the help!
    Gary

    There isn't a way to set this up using the Paypal payment integrated into FormsCentral using seperate forms for each child, you can set up one form so they can register additional children and then pay in one session, but if you need each child to be a unique form submission it can not be set up to pay for multiple at once.
    Thanks,
    Josh

  • Submitting multiple forms with one Submit button?

    I'm working to create a web app for the iphone and am using
    an apple developed css within an html page. In doing so I have
    created three forms within the single page and would like to submit
    them simultaneously with one submit. I've looked and tried a few
    javascripts but nothing has worked thus far. All three forms call
    the same action (php).
    Is this possible using js or another function?

    .oO(iRyFlash)
    >I'm working to create a web app for the iphone and am
    using an apple developed
    >css within an html page. In doing so I have created three
    forms within the
    >single page and would like to submit them simultaneously
    with one submit. I've
    >looked and tried a few javascripts but nothing has worked
    thus far. All three
    >forms call the same action (php).
    >
    > Is this possible using js or another function?
    Make it a single form.
    Micha

  • Form with variable number of fields?

    I need to write a data entry form in JSF. It's the standard kind of things, a series of labels and textFields and checkboxes and so on.
    The number of items is not known in advance. It is data-dependent. There might be 1 label-value pair sometimes and 10 label-value pairs another time, depending on the data.
    To do this in JSF would I have to write a custom component? Using JSP and JSTL tags I would write a <c:forEach> loop, but it seems like that's not the right thing to do in JSF. Does anybody have experience with this, or an example that could get me started? Thanks.

    I think the table would handle the layout and repetition of rows. But if some of the input fields are text input and some are checkboxes or another type, how would I get the right type of input on each row? Do you have an example where the backing bean dynamically builds components, that I could look at? Thanks.

  • Form with variable length pages

    Hi,
    I have a form which has categories of data - some categories require many fields and some require only a handful of fields. I want to put each category on a single page. My Master Page has a graphic which serves as a background for all of the pages.
    Is there a way through Designer ES or JavaScript to vary the length of each page? Or, could I somehow assign the background graphic image to a variable so that if I have a different Master Page assigned to each category's page, the image can be stored once and somehow referenced by each page. (I want to avoid creating multiple copies of the image that are of varying lengths - this will take the file length unwieldly.)
    Thanks,
    Jeff

    I think the table would handle the layout and repetition of rows. But if some of the input fields are text input and some are checkboxes or another type, how would I get the right type of input on each row? Do you have an example where the backing bean dynamically builds components, that I could look at? Thanks.

  • I am having a problem with check boxes showing as all selected after downloading as a pdf after individual submits their form with just a few actually selected.

    The forms themselves don't have all the boxes checked when viewed in FormsCentral. It is only after I download it as a pdf that the problem occurs. I have to check and uncheck each box in the FormsCentral in order to not have that occur. Any suggestions?

    Hi sdwinter,
    Please help us with the step by step workflow to replicate the issue for better assistance on this.
    Thanks,
    Vikrantt Singh

Maybe you are looking for