Jump to content

JS Problem ::SOLVED::


coldkill

Recommended Posts

Hey folks,
I have a slight problem with one of my JS scripts. It doesn't work for one ¬¬.

It is supposed to change the action value of a form and is called from the onClick HTML function.

Here is a the script:
[code]
function Action()
{
var form = document.getElementById(\'editform\');
var checkbox = document.getElementById(\'preview\');

if( checkbox.checked == true )
{
form.action = "'.DOMAIN.'index.php?module=admin&id=news_mod&preview"
}
else
{
form.action = "'.DOMAIN.'source/action/exec.php"
}
}[/code]
It's echoed from a PHP script and DOMAIN is changed for the current working directory of the site.

Thanks in advance,
Mike
Link to comment
Share on other sites

Yeah, it is called but it doesn't do anything when it's called. It's called by the checkbox called "preview" with the onclick [xHTML] function.

Heres the form code. I took out some buttons from this example which arn't useful to solving this problem.

Thanks,
Cold

[code]
<form action="'.DOMAIN.'source/action/exec.php" mothod="post" name="editform" id="editform" enctype="application/x-www-form-urlencoded">
<table cellpadding="0" border="0" width="100%">
<tr>
<td>Title:</td>
        <td><input name="title" type="text" class="inputhelp"></td>
</tr>
<tr>
<td></td>
<td><input id="use" type="text" value="Help" readonly="true" class="inputhelp" /></td>
</tr>
<tr>
<td>Text:</td>
<td><textarea name="post" class="inputarea"></textarea></td>
</tr>
<tr>
<td>Preview news post?</td>
<td><input name="preview" id="preview" type="checkbox" onclick="javascript:Action()" value="checked"></td>
</tr>
<tr>
        <td><input name="type" type="hidden" value="news" /></td>
        <td><input name="submit" type="submit" value="Submit" class="submitbutton"/></td>
</tr>
</table>
</form>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.