Welcome Guest, Not a member yet? Register   Sign In
input->post with Ajax.Update issue
#1

[eluser]Oguz[/eluser]
Hi,

At my code i have a form including a div like below

<div id="A">

&lt;input type="text" name="A" id="A" /&gt;

</div>

By using Ajax.Updater i am updating this div section as below

<div id="A">

&lt;input type="text" name="A" id="A" value"B" /&gt;

</div>

When i replace it with the new input to show the B value on the web page, the return value of $this->input->post('A') is nothing. I was trying to update one text field auotmatically depending on the other one according to some xml values. So any idea why i dont get "B" value after i submited the form?
#2

[eluser]JHackamack[/eluser]
Did you miss an equal sign between the value"b" IE:
&lt;input type=“text” name=“A” id=“A” value="B” /&gt;
#3

[eluser]Oguz[/eluser]
I just mistyped it. It is &lt;input type=“text” name=“A” id=“A” value=“B” /&gt; way at the code also.
#4

[eluser]Oguz[/eluser]
So missing equal is not the answer.
#5

[eluser]JHackamack[/eluser]
Can you post the whole form? Also, when you do an ajax.update of the value does it display in the web browser as a text field with the letter B in it?
#6

[eluser]Oguz[/eluser]
basically it is something like
<table>
<tr>
<td>
&lt;?php echo validation_errors(); ?&gt;
&lt;?php echo form_open('some/url'); ?&gt;
</td>
</tr>

<tr>
<td>
some form elemnt
</td>
</tr>

..

<tr>
<td>
<div id="A_area">
<label for="A">hede:</label><br>
&lt;input type="text" name="A" id="A" size="10"&gt;&lt;br>
</div>
</td>
</tr>

After the update, the div becomes

<tr>
<td>
<div id="A_area">
<label for="A">hede:</label><br>
&lt;input type="text" name="A" id="A" size="10" value="something"&gt;&lt;br>
</div>
</td>
</tr>

After the update, i can get the other fields value with $this->input->post(), but after the update.ajax i dont get any value from A.
#7

[eluser]JHackamack[/eluser]
And after the update the browser displays the new value for "A". Also, have you made sure the &lt;/form&gt; is after the inserted materials?
#8

[eluser]Oguz[/eluser]
Yes the new value is shown but i can not get the post value. I am closing the form also. There is no tag problem.
#9

[eluser]JHackamack[/eluser]
If you initially set the input to
&lt;input type=“text” name=“A” id=“A” size=“10” value="" /&gt;

Are you seeing an empty value being sent on submit?
#10

[eluser]Oguz[/eluser]
If i create the input element with a value by default, and submit the form, i can see that i get the values.
The problem occurs when the Ajax.Updater is run and updates the current input element.

Below is what i returned from my url in ajax update:

$s = '<label for="A">A:</label><br>';
$s .= '&lt;input type="text" name="A" size="10" id="A" value="'.$somevariable.'"' . '&gt;';

returning $s from url.

When i checked the source code of the produced html, it is the same html with the one at the view.




Theme © iAndrew 2016 - Forum software by © MyBB