Topic: xajax form action replacement


Just as xajax.$ is a replacement for js document.getElementById(id)

could there be a xajax.$$ for document.form.action (param),which would be a way to 'on the fly' change
the ? and & params

I want the selection of a form1 outcome to dictate a change of the next forms2 action.

action="/cgi-bin/upload.cgi?xray=<? $xray ?>&zray=<?$zray?>

The only way to do it now is to wholesale replace the entire form action


Re: xajax form action replacement

You could configure the action using javascript (where the parameters can be configured programatically):

xrayValue = null;
zrayValue = null;

function processForm1($aFormValues)
    $xrayValue = 'some new value';
    $zrayValue = 'some new value';

    $objResponse = new xajaxResponse();
    $objResponse->script('xrayValue = "' . $xrayValue . '";');
    $objResponse->script('zrayValue = "' . $zrayValue . '";');
    return $objResponse;

(form2 submit button)
<input type='button' onclick='xajax.$("form2").action = "/cgi-bin/upload.cgi?xray=' + xrayValue + '&zray=' + zrayValue + '"; xajax.$("form2").submit();'>

Does that help?

// Joe

xajax Developer
Connect to me on LinkedIn:

3 (edited by robertlam 2007-04-16 5:17:43 PM)

Re: xajax form action replacement

Hi Joe

This is very clear.  thanx

I wanted to pass the valus from form1 to form2 via the action=?xxxx&ddd&ssss.   desided to tackel the form1 issue standalone.  I i disable form2's browse and submit button while i'm working on form1 an when form1 is completed enable those two buttons.

in form1 i am using onblur to validation.  Eaxh text field and one select tag is individually validated.  Basically i'm using identical code for each of the 4 validations.  The first on goes smoothly but the second and thrid run into each other and the 4 does not work.

do you know how to set a setTimeout(function() on the onblur?  There are two active thread on the forum  that relate to this quiestion.  If you have the time could you read those thread and comment.